| fseek | Function (tigcc.a)

stdio.h

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

Repositions the file pointer of a stream.

fseek sets the file pointer associated with stream to a new position that is offset bytes from the file location given by whence. For text mode streams (see fopen), offset should be 0 or a value returned by ftell. whence must be one of the following values (defined in enum SeekModes):

whence | File location
SEEK_SET | File beginning
SEEK_CUR | Current file pointer position
SEEK_END | End-of-file

fseek discards any character pushed back using ungetc. fseek returns 0 if the pointer is successfully moved. It returns a nonzero value on failure.

Used by: fsetpos, rewind