COHERENT manpages

This page displays the COHERENT manpage for fsetpos() [Set file-position indicator].

List of available manpages
Index


fsetpos() -- STDIO Function (libc)

Set file-position indicator
#include <stdio.h>
int
fsetpos(fp, position)
FILE *fp; fpos_t *position;

fsetpos() resets the file-position indicator.  fp points to the file stream
whose indicator is being reset.  position is a value that had been returned
by an earlier call to fgetpos().  It is of type fpos_t, which is defined in
the header stdio.h.

Like  the  related  function  fseek(),  fsetpos()  clears  the  end-of-file
indicator and undoes  the effects of a previous call  to ungetc(). The next
operation on fp may read or write data.

fsetpos() returns zero if all goes  well.  If an error occurred, it returns
nonzero and sets errno to an appropriate value.

Example

For an example of this function, see fgetpos().

See Also

fgetpos(),
fseek(),
ftell(),
libc,
rewind()
ANSI Standard, §7.9.9.3

Notes

The  ANSI Standard  designed fsetpos()  to  be used  with files  whose file
position cannot  be represented within  a long. Under  COHERENT, it behaves
the same as fseek().

If you wish to use fsetpos(),  you should first call the function fgetpos()
to obtain value of the file-position indicator.

You can  also use the  functions ftell() and fset(),  respectively, to read
and  set  the  file-position  indicator.   However,  code that  uses  these
function may  not be portable  to operating systems other  than COHERENT or
UNIX.