Purpose
 
 
 Open a file
 
 
 
 
 
 
 
 
  and make it the active input, output or error stream.
 
  Synopsis
 
 
 procedure fopen(f:string, mode:integer)
 
 
  Arguments
 
 
 
  
   | 
     f 
     | 
     The name of the file to be opened
     | 
  
   | 
     mode 
     | 
     The open mode that consists in a stream selection and optional flags. The stream is one of:
     
     
      
       | 
         F_INPUT 
         | 
         Input stream (for reading)
         |  
       | 
         F_OUTPUT 
         | 
         Output stream (for writing)
         |  
       | 
         F_ERROR 
         | 
         Error stream (for writing error messages)
         |  
     Possible optional flags (to be combined with the stream selection):
     
     
      
       | 
         F_APPEND 
         | 
         Open for writing, appending new data to the end of the file (otherwise the file is cleared before opening)
         |  
       | 
         F_TEXT 
         |  |  
       | 
         F_BINARY 
         |  |  
       | 
         F_LINBUF 
         | 
         If open for writing, flushes buffer after end of each line (default when writing to a console or for an error stream)
         |  
       | 
         F_SILENT 
         | 
         Do not display IO error messages
         |  | 
 
 
  Further information
 
 
 1. This procedure opens a file for reading or writing. If the operation succeeds, depending on the opening mode, the file becomes the active input, output or error stream. The procedures
 
write and
 
writeln are used to write data to the default output stream and the functions
 
read,
 
readln, and
 
fskipline are used to read data from the default input stream. Error messages are sent to the error stream.
 
 2. The behavior of this function in case of an IO
 
 error (
 
i.e. the file cannot be opened) is directed by
 
 the control parameter
 
ioctrl (see
 
setparam): if the value of this parameter is `false' (default value), the interpreter stops. Otherwise, the interpreter ignores the error and continues. The error status of an IO operation is stored in the control parameter
 
iostatus (see
 
getparam) which is 0 when
 
  the last operation has been executed successfully. Note that this parameter is automatically reset once its value has been read using the function
 
getparam. The behavior of IO operations after an unhandled error is not defined.
 
  Related topics
 
 
                 
                
                    © 2001-2023 Fair Isaac Corporation. All rights reserved. This documentation is the
                    property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not
                    convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except
                    solely for internal evaluation purposes to determine whether to purchase a license to the software
                    described in this documentation, or as otherwise set forth in a written software license agreement
                    between you and FICO (or a FICO affiliate). Use of this documentation and the software described in
                    it must conform strictly to the foregoing permitted uses, and no other use is permitted.