Sign in Join
FPDoc Onlineexperiment

TFileStream.Create constructor

Member of TFileStreampublicIn unit Classes

Creates a file stream.

Declaration

pascal
constructor Create(const AFileName: string; Mode: Word)
constructor Create(const AFileName: string; Mode: Word; 
 Rights: Cardinal)

Description

Create creates a new instance of a TFileStream class. It opens the file AFileName with mode Mode, which can have one of the following values:

fmCreate Create creates a new file if needed.
fmOpenRead Create opens a file with read-only access.
fmOpenWrite Create opens a file with write-only access.
fmOpenReadWrite Create opens a file with read-write access.

These constants (except fmCreate) can be OR-ed with the following to specify how sharing and file locking is supposed to be handled:

fmShareCompat

Open file in DOS share-compatibility mode.

fmShareExclusive

Lock file for exclusive use.

fmShareDenyWrite

Lock file so other processes can only read.

fmShareDenyRead

Lock file so other processes cannot read.

fmShareDenyNone

Do not lock file.

Note that sharing is advisory on Unix-like platforms.

After the file has been opened in the requested mode and a handle has been obtained from the operating system, the inherited constructor is called.

Errors

If the file could not be opened in the requested mode, an EFOpenError exception is raised.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.