C Programming/C Reference/stdio.h/fgetpos
||A Wikibookian suggests that this book or chapter be merged into C file input/output.
Please discuss whether or not this merge should happen on the discussion page.
- 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).