.TH fsetpos() "" "" "STDIO Function (libc)"
.PC "Set file-position indicator"
.B "#include <stdio.h>"
\fBint\fR
\fBfsetpos(\fIfp\^\fB, \fIposition\^\fB)\fR
\fBFILE *\fIfp\^\fB; fpos_t *\fIposition\^\fB;\fR
.PP
.II "file-position indicator^set"
.B fsetpos()
resets the file-position indicator.
.I fp
points to the file stream whose indicator is being reset.
.I position
is a value that had been returned by an earlier call to
.BR fgetpos() .
It is of type
.BR fpos_t ,
which is defined in the header
.BR stdio.h .
.PP
Like the related function
.BR fseek() ,
.B fsetpos()
clears the end-of-file indicator and undoes the effects of a previous call to
.BR ungetc() .
The next operation on
.I fp
may read or write data.
.PP
.B fsetpos()
returns zero if all goes well.
If an error occurred, it returns nonzero and sets
.B errno
to an appropriate value.
.SH Example
For an example of this function, see
.BR fgetpos() .
.SH "See Also"
.Xr "fgetpos()," fgetpos
.Xr "fseek()," fseek
.Xr "ftell()," ftell
.Xr "libc," libc
.Xr "rewind()" rewind
.br
\*(AS, \(sc7.9.9.3
.SH Notes
The ANSI Standard designed
.B fsetpos()
to be used with files whose file position cannot be represented within a
.BR long .
Under \*(CO, it behaves the same as
.BR fseek() .
.PP
If you wish to use
.BR fsetpos() ,
you should first call the function
.B fgetpos()
to obtain value of the file-position indicator.
.PP
You can also use the functions
.B ftell()
and
.BR 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 \*(CO or \*(UN.
