fgetpos.3s (2010 09)

f
fgetpos(3S) fgetpos(3S)
NAME
fgetpos( ), fsetpos( ) - save and restore a file position indicator for a stream
SYNOPSIS
#include <stdio.h>
int fgetpos(FILE *__restrict stream, fpos_t *__restrict pos);
int fsetpos(FILE *stream, const fpos_t *pos);
DESCRIPTION
fgetpos() Store the current value of the file position indicator for the stream pointed to by stream
in the object pointed to by pos. The value stored contains information usable by
fset-
pos() for repositioning the stream to its position at the time of the call to
fgetpos().
fsetpos() Set the file position indicator for the stream pointed to by stream according to the value
of the object pointed to by pos , which must be a value set by an earlier call to
fget-
pos() on the same stream.
A successful call to
fsetpos() clears the end-of-file indicator for the stream and
undoes any effects of ungetc(3S) on the same stream. After a
fsetpos() call, the next
operation on a update stream can be either input or output.
RETURN VALUE
If successful, these functions return zero; otherwise non-zero.
ERRORS
If
fgetpos() fails, errno is set to one of the following values.
[EINVAL] The current value of the file position cannot be represented correctly in an object of size
fpos_t in this environment.
Additional
errno values may be set by the underlying ftell() function (see fseek (3S)).
WARNINGS
Failure can occur if these functions are used on a file that has not been opened via
fopen(). In particu-
lar, they must not be used on a terminal or on a le opened via popen (3S).
fsetpos() has no effect on streams that are open for append (see fopen (3S)).
SEE ALSO
fgetpos64(3S), fseek(3S), fopen(3S), popen(3S), ungetc(3S), thread_safety(5), glossary(9).
STANDARDS CONFORMANCE
fgetpos(): AES, SVID3, XPG4, ANSI C
fsetpos(): AES, SVID3, XPG4, ANSI C
HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (2 pages)