c/io/fseek

Sets the file position indicator for the file stream to the value pointed to by.

If the is open in binary mode, the new position is exactly  bytes measured from the beginning of the file if  is seek_set, from the current file position if  is seek_cur, and from the end of the file if  is seek_end. Binary streams are not required to support seek_end, in particular if additional null bytes are output.

If the is open in text mode, the only supported values for  are zero (which works with any ) and a value returned by an earlier call to ftell on a stream associated with the same file (which only works with  of seek_set).

If the is wide-oriented, the restrictions of both text and binary streams apply (result of ftell is allowed with seek_set and zero offset is allowed from seek_set and seek_cur, but not seek_end).

In addition to changing the file position indicator, undoes the effects of ungetc and clears the end-of-file status, if applicable.

If a read or write error occurs, the error indicator for the stream (ferror) is set and the file position is unaffected.

Return value
upon success, nonzero value otherwise.