fgetpos is a function in the I/O section of the C standard library.

Usage edit

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

fgetpos() will retrieve the file offset (in bytes) from stdio stream stream into storage of type fpos t pointed to by variable pos, which should be allocated by the caller. This variable should only be used for subsequent calls to fsetpos(). A separate function, ftell() can be used instead in order to retrieve the value of the file offset as a long integer.

The return value is 0 on successful completion, or -1 on error (in which case errno is set accordingly).