Opens a file for reading or writing and returns a file handle for use in subsequent file operations.
Input |
Name |
Type |
Description |
fileName |
string |
Pathname that specifies the file to open. |
read/writeMode |
integer |
Specifies what combination of reading and writing you may perform on the file.
If the read/writeMode argument is write or read/write, OpenFile creates the file if it does not already exist. Use GetFileInfo to determine whether a file already exists. OpenFile creates files with full read and write permissions.
- VAL_READ_WRITEOpen file for reading and writing.
- VAL_READ_ONLYOpen file for reading only.
- VAL_WRITE_ONLYOpen file for writing only.
 |
Note The default value is read only. |
|
action |
integer |
Specifies whether to delete the old contents of the file and whether to force
the file pointer to the end of the file before each write operation. action is meaningful only if read/writeMode is VAL_READ_WRITE or VAL_WRITE_ONLY. After you perform read operations, the file pointer points to the byte that follows the last byte read. action values are as follows:
- VAL_TRUNCATEPositions the file pointer at the beginning of the file and deletes the prior file contents.
- VAL_APPENDAppends all write operations to the end of the file.
- VAL_OPEN_AS_ISPositions the file pointer at the beginning of the file but does not affect the prior file contents.
|
fileType |
integer |
Specifies whether to treat the data in the file as ASCII or binary. When you perform I/O
on a file in binary mode, carriage returns (CR) and linefeeds (LF) receive no special treatment. When you open the file in ASCII mode, each CR/LF combination translates to an LF when reading, and each LF translates to a CR/LF combination when writing. fileType values are as follows:
|