fsetpos, fsetpos64, fgetpos, fgetpos64 - reposition a file pointer in a
int fsetpos (FILE *stream, const fpos_t *pos);
int fsetpos64 (FILE *stream, const fpos64_t *pos);
int fgetpos (FILE *stream, fpos_t *pos);
int fgetpos64 (FILE *stream, fpos64_t *pos);
Fsetpos and fgetpos save and restore the file position indicated by the
value of the object pointed at by pos.
The functions fsetpos64 and fgetpos64 are identical to fsetpos and
fgetpos respectively, except that they take an fpos64_t * as an argument.
This allows for the specification of a file position that is greater that
A call to fgetpos stores the current value of the file position indicator
for stream in the object pointed at by pos. The information is encoded
in a format which may only be usable by fsetpos for the repositioning the
stream to its position at the time of the call to fgetpos.
Fsetpos restores the file position of the stream to the value encoded in
the object pointed at by pos, which must have been set by a previous call
to fgetpos on the same stream. A successful call to fsetpos clears the
end-of-file indicator for the stream and undoes any effect of the
ungetc(3S) function on it. After a call to fsetpos, the next operation
on an update stream may be either input or output.
lseek(2), fseek(3s), fopen(3S), popen(3S), stdio(3S), ungetc(3S).
If successful, both fsetpos and fgetpos return zero. On failure, they
return non-zero and set errno to indicate the error.
PPPPaaaaggggeeee 1111 [ Back ]