CFile Access Modes
The CFile class can access files in binary or text compatibility mode for reading, writing, or appending. The Open method sets the file access using an access mode string that describes all of these options. The table below lists pre-defined file access mode strings, which are the standard names inherited from the C language.
CFile Access Mode Definitions
Mode String |
Translation Mode |
Open for: |
"rt" |
Text |
Reading |
"wt" |
Text |
Writing |
"w+t" |
Text |
Write with Append |
"r+t" |
Text |
Read and Write |
"a+t" |
Text |
Read and Write with Append |
The following script fragment opens a text file for reading and writing, beginning at the end of the file. Note that the mode name is prefixed by the instance of the class, F, and not by the class name:
|
-- create a new CFile instance |
|
-- open as text for reading and writing |