Returns the current byte offset to the specified stream file.
Format
#include <stdio.h>
long int ftell (FILE *file_ptr);
1 – Argument
file_ptr
A file pointer.
2 – Description
The ftell function measures the byte offset from the beginning of
the file.
For variable-length files, VFC files, or any file with carriage-
control attributes, if the file is opened in record mode, then
ftell returns the starting position of the current record, not
the current byte offset.
When using record files, the ftell function ignores any
characters that have been pushed back using either ungetc or
ungetwc. This behavior does not occur if stream files are being
used.
For a portable way to measure the exact offset for any type of
file, see the fgetpos function.
3 – Return Values
n The current offset.
EOF Indicates an error.