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
FileModeto zero before callingReset. If you do not setFileMode,Resetwill fail when trying to open a read-only file, such as a file on a CD-ROM.To append to a binary file, set
FileModeto 1 or 2, open the file withReset, seek to the end of the file, and then begin writing.FileModeis not used when opening text files.FileModeis not used when opening a binary file withRewrite.
See Also
| Reset Procedure |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access