Home > Electronics Tutorials > C Language Tutorial > stdio.h - File Functions - fseek

C Language Programming Library Reference Guide

stdio.h - File Functions - 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 argument whence can be:
 
SEEK_SET Seeks from the beginning of the file.
SEEK_CUR Seeks from the current position.
SEEK_END Seeks 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.

Note: To report broken links or to submit your projects, tutorials please email to Webmaster

Discover

     more......