open_file — Open a file in ASCII or a binary format.
open_file opens a file in ASCII format or in binary format. The name of the file is defined by the parameter FileName. The operator returns the FileHandle. The parameter FileType determines the type of the file.
The following settings for FileType are supported:
An already existing input file is opened for reading in ASCII format.
A new output file is opened for writing in ASCII format.
An already existing output file is opened at the end of the file for writing in ASCII format.
An already existing input file is opened for reading in binary format.
A new output file is opened for writing in binary format.
An already existing output file is opened at the end of the file for writing in binary format.
For terminal input and output, the file names 'standard' ('input' and 'output') and 'error' (only 'output') are reserved.
This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.
Name of file to be opened.
Default value: 'standard'
Suggested values: 'standard', 'error', '/tmp/dat.dat'
Type of file.
Default value: 'output'
List of values: 'append', 'append_binary', 'input', 'input_binary', 'output', 'output_binary'
* Creating an output file with the name '/tmp/log.txt' and writing * of a string: open_file('/tmp/log.txt','output',FileHandle) fwrite_string(FileHandle,'these are the first and last lines') fnew_line(FileHandle) close_file(FileHandle)
If the parameters are valid, the operator open_file returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.
fwrite_string, fread_char, fread_string, fread_line, fread_serialized_item, fwrite_serialized_item, close_file
close_file, fwrite_string, fread_char, fread_string, fread_line