[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'Classes' (#rtl)

TFileStream.Create

Creates a file stream.

Declaration

Source position: line 0

public constructor TFileStream.Create(

  const AFileName: String;

  Mode: Word

);

constructor TFileStream.Create(

  const AFileName: String;

  Mode: Word;

  Rights: Cardinal

);

Description

Createcreates a new instance of a TFileStreamclass. It opens the file AFileNamewith mode Mode, which can have one of the following values:

fmCreate TFileStream.Createcreates a new file if needed.
fmOpenRead TFileStream.Createopens a file with read-only access.
fmOpenWrite TFileStream.Createopens a file with write-only access.
fmOpenReadWrite TFileStream.Createopens a file with read-write access.

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 EFOpenErrorexception is raised.

See also

TStream

  

Base class for streams.

TFileStream.FileName

  

The filename of the stream.

THandleStream.Create

  

Create a handlestream from an OS Handle.