FGETPOS - get current read/write position.

(ANSI Standard)


#include <stdio.h>
stat = fgetpos(stream,pos);


FILE *stream;
indicates the stream whose position you wish to determine.
fpos_t *pos;
points to a location where "fgetpos" can store the position information.
int stat;
is zero if the read/write position is successfully determined, and non-zero otherwise.


The "fgetpos" function notes the current read/write position of stream and stores this information in the object indicated by "pos". Information obtained through "fgetpos" can be used by the "fsetpos" function to return to this same position.

The information stored by fgetpos has an implementation-specific format. There is no guarantee that this information may be useful in any other way except as an argument to "fsetpos".

The "fgetpos" function is similar to "ftell". The difference is that "ftell" must represent the current read/write position as a long value, whereas "fgetpos" uses the implementation-defined "fpos_t" type. Since "fpos_t" represents the read/write position in a form that is specifically tailored to the execution environment, "fgetpos" and its partner "fsetpos" are usually preferable to "ftell" and "fseek".

See Also:

expl nsc lib fsetpos

expl nsc lib ftell

Copyright © 1996, Thinkage Ltd.