Show: Delphi C++
Display Preferences

System.FileMode

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

FileMode: Byte = 2;       { Standard mode for opening files }

C++

extern DELPHI_PACKAGE Byte FileMode;

Properties

Type Visibility Source Unit Parent
variable public
System.pas
System.hpp
System System

Description

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

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 file open modes that can be assigned to the FileMode variable are defined in the Constants list on System.SysUtils. The default FileMode is 2 (Read/Write access). Assigning another value to FileMode causes all subsequent Resets to use that mode.

The following table contains the available FileMode values:

FileMode Value Byte Value
fmExclusive 4
fmOpenRead 0
fmOpenReadWrite 2
fmOpenWrite 1
fmShareCompat 0
fmShareDenyNone 64
fmShareDenyRead 48
fmShareDenyWrite 32
fmShareExclusive 16
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.

See Also

Personal tools
In Other Languages
Previous Versions
Assistance