RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.FileMode Variable

Indicates the access mode on typed and untyped files opened by the Reset procedure.

Pascal
FileMode: Byte = 2;
C++
Byte FileMode = 2;

In Delphi code, FileMode determines the access mode to use when typed and untyped files (not text files) are opened using the Reset procedure. 

The default FileMode is 2 (Read/Write access). Assigning another value to FileMode causes all subsequent Resets to use that mode. The SysUtils unit declares a number of file open mode constants that can be assigned to the FileMode variable.

Note: Be sure to reset FileMode before calling Reset with a read-only file. Even if you are only reading from the file, the default FileMode value (Read/Write access) will cause an attempt to open a read-only file to fail.
Warning: FileMode is declared as a variable, not as a threadvar. Therefore this variable is not thread-safe.
 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!