FTELL - determine current position in I/O stream.

(ANSI standard)

Usage:

#include <stdio.h>
offset = ftell( f );

Where:

FILE *f;
points to the file whose stream position you wish to determine.
long offset;
is an indication of the current offset from the beginning of the file. A -1L is returned if an error occurs (e.g. the stream is associated with a terminal).

Description:

"ftell" returns the current position for input or output on the file indicated by "f". "offset" is not precisely a byte offset from the beginning of the file. Instead it is a logical offset that can be used by "fseek".

Notes:

We recommend that you use the ANSI standard functions "fsetpos" and "fgetpos" instead of "fseek" and "ftell". The reason is that "fseek" and "ftell" only use a long integer (36 bits) to represent a position in a file; this is not adequate to deal with all the positions in a large file on some systems. On the other hand, "fgetpos" and "fsetpos" use a larger information structure to represent file positions and can deal with any size file.

See Also:

expl c lib fseek

expl c lib fgetpos

expl c lib fsetpos

Copyright © 1996, Thinkage Ltd.