Functions HI-TECH C FSEEK

FSEEK

SYNOPSIS

#include  <stdio.h>

int fseek(FILE * stream, long offs, int wh)


DESCRIPTION

Fseek() positions the "file pointer" (i.e. a pointer to the next character to be read or written) of the specified stream as follows:

wh resultant location
0 offs
1 offs+previous location
2 offs+length of file

It should be noted that offs is a signed value. Thus the 3 allowed modes give postioning relative to the beginning of the file, the current file pointer and the end of the file respectively. EOF is returned if the positioning request could not be satisfied. Note however that positioning beyond the end of the file is legal, but will result in an EOF indication if an attempt is made to read data there. It is quite in order to write data beyond the previous end of file. Fseek() correctly accounts for any buffered data.

SEE ALSO

lseek, fopen, fclose