HP C/iX Library Reference Manual (30026-90004)
188 Chapter5
HP C/iX Library Function Descriptions
ftell
ftell
Returns the current file position indicator for the next I/O operation on an open stream.
Syntax
#include <stdio.h>
long int ftell (FILE *
stream
);
Parameters
stream
A pointer to an open stream.
Return Values
≥0 The current position for the next I/O operation, expressed as a byte offset
relative to the beginning of the open file. (The first byte is byte 0.)
−1 An error occurred.
Description
The ftell function returns the current value of the file position indicator for the stream
pointed to by
stream
. For a binary stream, the value is the number of characters from the
beginning of the file. For a text stream, its file position indicator contains unspecified data,
usable by fseek() for returning the file position indicator for the stream to its position at
the time of the call to ftell(). The difference between two such return values is not
necessarily a meaningful measure of the number of characters being read. The first byte of
the file is byte 0.
Examples
Refer to the examples located in the fseek function description.
See Also
rewind(), fseek(), ANSI C 4.9.9.4 , POSIX.1 8.1