Herror ::open_file (
    const HTuple &FileName,
    const HTuple &FileType,
    long *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 -> HTuple.char *
Name of file to be opened.
Default value: 'standard'
Suggested values: 'standard', 'error', ''/tmp/dat.dat''

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

FileHandle (output_control)
file -> long *
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 H_MSG_TRUE. Otherwise an exception handling is raised.


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-2002 MVTec Software GmbH