Open text file.
The operator open_file opens a file. FileType determines whether this file is an input ('input') or output file ('output' or 'append'). open_file creates files which can be accessed either by reading ('input') or by writing ('output' or 'append') are created. For terminal input and output the file names 'standard' ('input' and 'output') and 'error' (only 'output') are reserved.
|
FileName (input_control) |
filename -> string |
| Name of file to be opened. | |
| Default value: 'standard' | |
| Suggested values: 'standard', 'error', ''/tmp/dat.dat'' | |
|
FileType (input_control) |
string -> string |
| Type of file. | |
| Default value: 'output' | |
| List of values: 'input', 'output', 'append' | |
|
FileHandle (output_control) |
file -> integer |
| File handle. | |
/* Creating of an outputfile with the name '/tmp/log.txt' and writing */
/* of one 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 correct the operator open_file returns the value 2 (H_MSG_TRUE). Otherwise an exception handling is raised.
open_file is local and processed completely exclusively without parallelization.
fwrite_string, fread_char, fread_string, close_file
close_file, fwrite_string, fread_char, fread_string
Basic operators