C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
freopen
 Summary Example                         Up Contents Index Back
─────Run-Time Library───────────────────────────────────────────────────────
 
     The freopen function closes the file currently associated with
     <stream> and reassigns <stream> to the file specified by
     <filename>. The freopen function is typically used to redirect the
     preopened files stdin, stdout, and stderr to files specified by
     the user.
 
     The new file associated with <stream> is opened with <mode>, which
     is a character string specifying the type of access requested for
     the file.
 
     The valid types are "r" (read), "w" (write), and "a" (append).
     Any of these can be followed by a "+", which allows both read and
     write operations. Note that when you switch between reading and
     writing, there must be an intervening fsetpos, fseek, or rewind
     operation. The current position can be specified for the fsetpos
     or fseek operation, if desired. The translation mode for new lines
     can be specified by adding a "t" (text) or a "b" (binary).
 
     See: BINMODE.OBJ
 
     See also the individual constants for access type and translation
     mode:
          Access Types
          Translation Modes
 
     Return Value
 
     The freopen function returns a pointer to the newly opened file.
     If an error occurs, the original file is closed and the function
     returns a NULL pointer value.
                                    -♦-