FSEEK(3S)
NAME
fseek, ftell, rewind − reposition a stream
USAGE
#include <stdio.h>
fseek(stream, offset, ptrname) FILE *stream; long offset;
long ftell(stream) FILE *stream;
rewind(stream)
DESCRIPTION
Fseek sets the position of the next input or output operation on the stream. The new position is set at offset bytes from the beginning, the current position, or the end of the file, according to whether ptrname has been set to the value 0, 1, or 2, respectively.
Fseek cancels any of the effects of ungetc(3S).
Ftell returns the current value of the offset, in bytes, relative to the beginning of the file associated with the named stream.
Rewind(stream) is equivalent to fseek(stream, 0L, 0).
DIAGNOSTICS
Fseek returns -1 on an unsuccessful seek.