FAT | RFS | XFS | ZFS

fdopen2()

PROTOTYPE

#include <stdio.h>

FILE *fdopen2(int fid);

DESCRIPTION

fdopen2() is a non-standard routine similar to fdopen() except it neither clears the file’s error and end-of-file indicators nor checks the file’s open mode. It maps the POSIX file descriptor fid to its equivalent Standard C file pointer without any side effects. It does the reverse of fileno().

The return value is a valid file pointer only if fid is valid. fdopen2() does no error checking.

EXAMPLE

  fpos_t fpos;

  /*-------------------------------------------------------------------*/
  /* Retrieve current file position.                                   */
  /*-------------------------------------------------------------------*/
  if (fgetpos(fdopen2(smb->fid), &fpos))
    ferr = TRUE;