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;
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
andfmCreate
. The share mode must be one offmShareCompat
,fmShareExclusive
,fmShareDenyWrite
,fmShareDenyRead
orfmShareDenyNone
. -
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.