open_file ( : : FileName, FileType : FileHandle )

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.


Parameters

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.


Example
/* 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).
   

Result

If the parameters are correct the operator open_file returns the value 2 (H_MSG_TRUE). Otherwise an exception handling is raised.


Parallelization Information

open_file is local and processed completely exclusively without parallelization.


Possible Successors

fwrite_string, fread_char, fread_string, close_file


See also

close_file, fwrite_string, fread_char, fread_string


Module

Basic operators



Copyright © 1996-2005 MVTec Software GmbH