fgetpos(), fgetpos64()

get file position information for stream 

Function


SYNOPSIS

#include <stdio.h>

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

int fgetpos64(FILE *stream, fpos64_t *pos);


DESCRIPTION

The fgetpos() function stores the current value of the file position indicator for the stream pointed to by stream in the object pointed to by pos. The value stored contains information that the fsetpos() function uses to reposition the stream to its position at the time of the call to the fgetpos() function.

The fgetpos64() function is identical to the fgetpos() function except that it is capable of dealing with disk files that are larger than 2 gigabytes. The fgetpos64() function is a part of the large file extensions.


PARAMETERS

stream 

Is the stream whose positional information is desired.

pos 

Points to the structure that is to hold the positional information.


RETURN VALUES

If successful, the fgetpos() and fgetpos64() functions return zero. On failure, they return non-zero, and errno is set to one of the following values:

EBADF 

The file descriptor underlying stream is not valid.

EOVERFLOW 

The current value of the file position cannot be represented correctly in an object of type fpos_t or off_t.

ESPIPE 

The file descriptor underlying stream is associated with a pipe or FIFO.


CONFORMANCE

ANSI/ISO 9899-1990.

fgetpos64(): Large File Specification, revision 1.5.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

The file positions reported by fgetpos(), ftell(), or ftello() may be incorrect for files that are open in text mode in the case that the file is being read, or the case where the file is being written to and there is buffered data which has not yet been written to the underlying file. In the case that the file is being written to, fflush() can be used prior to calling fgetpos(), ftell(), or ftello() to ensure the accuracy of those functions. Text mode files with no buffering do not have this problem; however, performance can be significantly degraded with buffering turned off.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
fseek(), fsetpos(), lseek(), ungetc()

Miscellaneous:
lf64


PTC MKS Toolkit 10.2 Documentation Build 28.