Opening a file channel.
Syntax
openFile(
path STRING,
mode STRING )
- path is the path to the file to open.
- mode is the open mode, see usage for details.
Usage
The openFile() method can be used to open a file
for reading, writing, or both.
The opening mode can be one of the
following :
- r: For read mode: reads from a file (standard input if path is
NULL).
- w: For write mode: starts with an empty file (standard output if the path
is NULL).
- a: For append mode: writes at the end of a file (standard output if the
path is NULL).
- u: For read from standard input and write to standard output (path must be
NULL).
Any of these modes can be followed by:
- b: Open in binary mode, to avoid CR/LF (carriage return/line feed)
translation.
If the opening
mode is not one of the above letters, the method will
raise error
-8085.
When
you use the w or a modes, the file is created if it does not
exist.
The method raises error -8084 if the channel cannot be
opened.
CALL ch.openFile( "file.txt", "w" )