#include <stdio.h> #include <unistd.h>
int fseek (stream, offset, ptrname) FILE *stream; long offset; int ptrname;
long ftell (stream) FILE *stream;
void rewind (stream) FILE *stream;
The fseek function sets the position of the next input or output operation on the stream. The new position is at the signed distance offset bytes from the position specified by ptrname, which can be SEEK_CUR, SEEK_END or SEEK_SET. These positions are defined in the <unistd.h> header file as follows:
rewind(stream) is equivalent to fseek(stream, 0L, SEEK_SET), except that no value is returned.
fseek and rewind undo any effects of ungetc(S).
After fseek or rewind, the next operation on a file opened for update can be either input or output.
ftell returns the offset of the current byte relative to the beginning of the file associated with the named stream.
X/Open Portability Guide, Issue 3, 1989
ANSI X3.159-1989 Programming Language -- C ;
Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2) ;
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1) ;
and NIST FIPS 151-1 .