NAME
fgetpos, fseek, fsetpos, ftell, rewind - reposition a
stream
SYNOPSIS
#include <stdio.h>
fseek(stream, offset, ptrname)
FILE *stream;
long offset;
long ftell(stream)
const FILE *stream;
void rewind(stream)
const FILE *stream;
int fgetpos(stream, pos)
FILE *stream;
fpos_t pos;
int fsetpos(stream, pos)
FILE *stream;
const fpos_t pos;
DESCRIPTION
Fseek 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 beginning, the current position, or the end
of the
file, according as ptrname has the value 0 (SEEK_SET), 1
(SEEK_CUR), or 2 (SEEK_END).
Fseek undoes any effects of ungetc(3).
Ftell returns the current value
of the offset relative to the
beginning of the file associated with the named stream. It
is
measured in bytes on UNIX; on some other systems it is a
magic
cookie, and the only foolproof way to obtain an offset for
fseek.
Rewind(stream) is equivalent to fseek(stream, 0L, SEEK_SET).
Fgetposandfsetpos are alternate
interfaces equivalent to
ftellandfseek (with whence set to SEEK_SET), setting and
storing
the current value of the file offset into or from the object
referenced by pos.
SEE ALSO
lseek(2), fopen(3)
DIAGNOSTICS
Fseek returns -1 for improper seeks, otherwise zero.