From HI-TECH C for CP/M Fan WIKI(EN)
Revision as of 20:05, 31 July 2017 by Kumokosi (talk | contribs) (Created page with "<strong>FSEEK</strong> ==SYNOPSIS== #include <stdio.h> int fseek(FILE * stream, long offs, int wh) ==DESCRIPTION== <strong>Fseek</strong>() positions the "file pointer...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



#include  <stdio.h>

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


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.


lseek, fopen, fclose