Name
FileMode Variable
Syntax
var FileMode: Integer;
Description
When
opening a binary file with Reset
, Delphi always
opens the file using the mode specified by
FileMode
. The possible values for
FileMode
are as
follows:
- 0
Read only
- 1
Write only
- 2
Read and write
The default value is 2.
Tips and Tricks
To open an existing file for read-only access, be sure to set
FileMode
to zero before callingReset
. If you do not setFileMode
,Reset
will fail when trying to open a read-only file, such as a file on a CD-ROM.To append to a binary file, set
FileMode
to 1 or 2, open the file withReset
, seek to the end of the file, and then begin writing.FileMode
is not used when opening text files.FileMode
is not used when opening a binary file withRewrite
.
See Also
Reset Procedure |
Get Delphi in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.