The fseek function
int fseek(FILE *f, long int offset, int whence);
- set the cursor for stream
f , open for reading or writing
- puts it at location
offset bytes relative to whence
-
whence can have the values
-
SEEK_SET ... set offset relative to start of file
-
SEEK_CUR ... set offset relative to current location
-
SEEK_END ... set offset relative to end of file
- returns 0 if successful, -1 on error
- it is legitimate to seek beyond the current end of file
|