fileOpen(
const filename, // name of file
const mode) // open mode
Opens a file for reading/writing. Mode is the sum of any
of the following constants:
| Constant |
Description |
| fileOpenRead |
Open file for reading |
| fileOpenWrite |
Open file for writing |
| fileOpenAppend |
Open and set write position to EOF |
| fileOpenTrunc |
Truncate file if opened file existed before |
| fileOpenOld |
The file ought to exist (don't combine this with fileOpenNew). |
| fileOpenNew |
The file must not exist (don't combine this with fileOpenOld) |
| fileOpenBinary |
Open in binary mode. By default files are opened in text mode where EOL
is represented by a LF only. In Binary mode EOL may also be represented
as CR LF, depending on the operating system.
|
Returns a file handle that must be used in subsequent calls to
fileRead, fileWrite, fileClose etc.
Examples:
// open a file in text mode to append text
var fh = fileOpen('logfile.log',
fileOpenWrite+fileOpenAppend);
// open a file in binary mode for random access
var fh = fileOpen('address.dbf',
fileOpenRead+
fileOpenWrite+
fileOpenBinary);
|