open_file ( : : FileName, FileType : )

Open text file.

The operator open_file opens a file. FileType determines whether this file is an input ('input') or output file ('output'). Text files which can be accessed either by reading ('input') or by writing ('output') are created. The newly opened file becomes the active file, i.e. all input and/or output is handled by this file until the file is closed (close_file) or another file is activated (set_file).


Parameters

FileName (input_control)
string -> string
Name of file to be opened.
Default value: '/tmp/horus.txt'

FileType (input_control)
string -> string
Type of file.
Default value: 'output'
List of values: 'input', 'output'


Example
/* Creating of an outputfile with the name '/tmp/log.txt' and writing */
/* of one  string:                                                    */
   open_file(::'/tmp/log.txt','output':) >
   fwrite_string(::'these are the first and last lines':) >
   fnew_line(:::) >
   close_file(::output:).
   

Result

If the parameters are correct the operator open_file returns the value TRUE. Otherwise an exception is raised.


Possible Predecessors

init_horus


Possible Successors

set_file, fwrite_string, fread_char, fread_string, close_file


See also

close_file, fwrite_string, fread_char, fread_string, set_file



Copyright © 1996-1997 MVTec Software GmbH