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/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdio.h>
    FILE *fdopen( int handle, const char *mode );

Description:
    The fdopen function associates a stream with the file handle handle
    which represents an opened file or device.  The handle was returned by
    one of  creat,  dup,  dup2,  open, or  sopen.  The open mode mode must
    match the mode with which the file or device was originally opened.

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

Returns:
    The fdopen 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, fdopen returns a NULL pointer.  When an error has occurred,
     errno contains a value indicating the type of error that has been
    detected.

See Also:
    creat, dup, dup2, fopen, freopen, _fsopen, open, sopen

Example:
    #include <stdio.h>
    #include <fcntl.h>
    #include <io.h>

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

        handle = open( "file", O_RDONLY | O_TEXT );
        if( handle != -1 ) {
          fp = fdopen( handle, "r" );
          if( fp != NULL ) {
              fclose( fp );
          }
          close( handle );
        }
      }

Classification:
    POSIX 1003.1

Systems:
    All

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