fsetpos(3C)


fsetpos, fsetpos64, fgetpos, fgetpos64 -- reposition a file pointer in a stream

Synopsis

   

#include <stdio.h>

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);

Description

fsetpos sets the position of the next input or output operation on the stream according to the value of the object pointed to by pos. The object pointed to by pos must be a value returned by an earlier call to fgetpos on the same stream.

fsetpos clears the end-of-file indicator for the stream and undoes any effects of the ungetc function on the same stream. After fsetpos, the next operation on a file opened for update may be either input or output.

fgetpos stores the current value of the file position indicator for stream in the object pointed to by pos. The value stored contains information usable by fsetpos for repositioning the stream to its position at the time of the call to fgetpos.

Return values

If successful, fsetpos, fsetpos64, fgetpos, and fgetpos64 return zero. Otherwise, they all return nonzero and set errno to indicate the error. For example, errno is set by fgetpos when the current value of the file position cannot be represented correctly in an object of type fpos_t.

References

fseek(3S), intro(2), lseek(2), ungetc(3S)

Notices

Considerations for large file support

fsetpos64 and fgetpos64 support large files, but are otherwise identical to their counterparts. For details on programming for large file capable applications, see ``Large File Support'' on intro(2).
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004