<< Previous | Next >>

fseek (FS1)

int fseek( File * f, long to, char whence );

Description

Places the read pointer at a desired location in the file.

Parameters

f
A pointer to the file to seek into.

to
The number of bytes to move the read pointer. This can be a positive or negative number.

whence
The location in the file to offset from. This is one of the following constants.

SEEK_SET - Seek from the beginning of the file.
SEEK_CUR - Seek from the current read position in the file.
SEEK_END - Seek from the end of the file.


Example

To seek to 10 bytes from the end of the file f, use

   

fseek(f, -10, SEEK_END); 

To rewind the file f by 5 bytes, use

   

fseek(f, -5, SEEK_CUR);

Return value

0: Success.
1: Failure.

Library

FILESYSTEM.LIB


Dynamic C Functions << Previous | Next >> rabbit.com