Everything

ftell


Obtains the current read/write position in a stream input/output file.

[Format]

#include <stdio.h>

long ftell (FILE *fp);

[Parameters]

fp File pointer

[Return values]

Current file position indicator position (text file)

Number of bytes from beginning of file to current position (binary file)

[Remarks]

The ftell function obtains the current read/write position in the stream input/output file indicated by file pointer fp.

For a binary file, the ftell function returns the number of bytes from the beginning of the file to the current position. For a text file, it returns, as the position of the file position indicator, an implementation-defined value that can be used by the fseek function.

When the ftell function is used twice for a text file, the difference in the return values will not necessarily represent the actual distance in the file.