#include <stdio.h> int fgetpos(FILE *f, fpos_t *pos);
fgetpos
determines the current file position for the stream associated
with the FILE
object addressed by f
, and it stores the file
position in the object pointed to by pos
. This object is of type
fpos_t
, which is defined in stdio.h
. The stored value can be
passed to the fsetpos
function to reposition the file to its position at
the time of the call to fgetpos
.
You can use fgetpos
with most types of files, using either text or
binary access. Note that you can use it to obtain the current position for
many files that ftell
cannot process, including files accessed as a
binary stream using the "seq"
access method. See Tables 3.5 and 3.6
for file types that are not fully supported by fgetpos
.
fgetpos
returns 0. If it fails, fgetpos
returns a
nonzero value and stores an appropriate error code in errno
. See
The errno Variable for the list of errno
values.
A program that uses the components of an fpos_t
value is
not portable.
fgetpos
and the structure of fpos_t
values.
fsetpos
.
fsetpos
, ftell
, kgetpos
, lseek
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.