Icon Create Method

constructor Create(const AFileName: String; const Mode: Integer;
      const Rights: Integer=0)

Available In: Server Applications

Use this method to create a new instance of the TFileStream class for accessing the specified file.

Information The specified file name should contain an absolute path. Relative paths are permitted, but they rely on the current working directory. The current working directory is a per-process setting and is not reliable in a multi-threaded setting like the web server.

The mode parameter is specified by OR'ing a file create/open mode with a file sharing mode.

The valid create/open modes are:

Open ModeDescription
FILE_CREATE ($FF00)Specifies that the file should be created, regardless of whether the file already exists.
FILE_CREATE_EXCLUSIVE ($0004)OR'd with FILE_CREATE, specifies that the file should only be created if it doesn't already exist. If the file already exists, then an exception is raised.
FILE_OPEN_READ ($0000)Specifies that the file should be opened with read capabilities.
FILE_OPEN_WRITE ($0001)Specifies that the file should be opened with write capabilities.
FILE_OPEN_READWRITE ($0002)Specifies that the file should be opened with read and write capabilities.

The valid sharing modes are:

Sharing ModeDescription
FILE_SHARE_EXCLUSIVE ($0010)Specifies that no other processes will be able to open the file until the file stream is destroyed.
FILE_SHARE_DENYWRITE ($0020)Specifies that no other processes will be able to write to the file until the file stream is destroyed.
FILE_SHARE_DENYNONE ($0040)Specifies that other processes will be able to open, read, and write to the file.

Information The rights parameter is not used under Windows.

Image