Returns the current byte offset to the specified stream file.
#include <stdio.h> long int ftell (FILE *file_ptr);
For variable-length files, VFC files, or any file with carriage- control attributes, it 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.
n | The current offset. |
EOF | Indicates an error. |