Skip to content

Latest commit

 

History

History
33 lines (19 loc) · 1.33 KB

TPJFileHandle-Create.md

File metadata and controls

33 lines (19 loc) · 1.33 KB

Create constructor

Project: I/O Utility Classes

Unit: PJFileHandle

Class: TPJFileHandle

Applies to: ~>1.0

constructor Create(const FileName: string; const Mode: LongWord;
  const Inheritable: Boolean = True); overload;

constructor Create(const FileName: string; const Mode: LongWord;
  const Security: PSecurityAttributes); overload;

Description

These two overloaded constructors open or create files and record the file handle in the Handle property.

Parameters are:

  • FileName - Name of file to be opened or created.

  • Mode - File open mode. This is made up of an access mode constant ORd with a share mode constant. Valid access modes are fmOpenRead, fmOpenWrite, fmOpenReadWrite and fmCreate. The share mode must be one of fmShareCompat, fmShareExclusive, fmShareDenyWrite, fmShareDenyRead or fmShareDenyNone.

  • Inheritable - Indicates whether the file handle is to be inheritable.

  • Security - Points to a TSecurityAttributes record that specifies the required security for the file. If the file handle is to be inheritable set the bInheritHandle field to True.

The constructors raise EFCreateError or EFOpenError exceptions if a file cannot be created or opened respectively.