FileMode Variable
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:
Read only
Write only
Read and write
The default value is 2.
To open an existing file for read-only access, be sure to set
FileMode
to zero before calling
Reset
. If you do not set
FileMode
, 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 with Reset
, 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
with Rewrite
.