Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdio.h>
    FILE *freopen( const char *filename,
                   const char *mode,
                   FILE *fp );
    FILE *_wfreopen( const wchar_t *filename,
                     const wchar_t *mode,
                     FILE *fp );

Description:
    The stream located by the  fp pointer is closed.  The freopen function
    opens the file whose name is the string pointed to by filename, and
    associates a stream with it.  The stream information is placed in the
    structure located by the fp pointer.

    The argument mode is described in the description of the  fopen
    function.

    The _wfreopen function is identical to freopen except that it accepts
    wide-character string arguments for filename and mode.

Returns:
    The freopen function returns a pointer to the object controlling the
    stream.  This pointer must be passed as a parameter to subsequent
    functions for performing operations on the file.  If the open operation
    fails, freopen returns NULL.  When an error has occurred,  errno
    contains a value indicating the type of error that has been detected.

Example:
    #include <stdio.h>

    void main()
      {
        FILE *fp;
        int c;

        fp = freopen( "file", "r", stdin );
        if( fp != NULL ) {
          while( (c = fgetchar()) != EOF )
            fputchar(c);
          fclose( fp );
        }
      }

Classification:
    freopen is ANSI, _wfreopen is not ANSI

Systems:
     freopen - All, Netware

    _wfreopen - All

See Also:
    fclose, fcloseall, fdopen, fopen, _fsopen

See Also: fclose fcloseall

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson