FAT | RFS | XFS | ZFS

fgetpos()

PROTOTYPE

#include <stdio.h>

int fgetpos(FILE *file, fpos_t *pos);

DESCRIPTION

fgetpos() stores the current position of the open file identified by file in the opaque object *pos. Application programs cannot interpret this value. It can only be used in later calls to fsetpos().

If successful, fgetpos() returns 0. Otherwise, it sets errno and returns a nonzero value.

ERROR CODES

EBADF file is not the handle of an open file.
EFAULT pos equals NULL.
EISDIR The specified file is a directory.

EXAMPLE

fpos_t pos;

/*-----------------------------------------------------------------*/
/* Get current position for the stream.                            */
/*-----------------------------------------------------------------*/
if (fgetpos(file, &pos))
{
  perror("error getting file's current position");
  return -1;
}