2.12.3.10 fseek

Declaration:

int fseek(FILE *stream, long int offset, int whence);

Sets the file position of the stream to the given offset. The argument offset signifies the number of bytes to seek from the given whence position. The argumentwhence can be:

SEEK_SETSeeks from the beginning of the file.
SEEK_CURSeeks from the current position.
SEEK_ENDSeeks from the end of the file.

On a text stream, whence should be SEEK_SET and offset should be either zero or a value returned from ftell.

The end-of-file indicator is reset. The error indicator is NOT reset.

On success zero is returned. On error a nonzero value is returned.