ftell reports a stream’s current file position as a byte offset from the beginning of the file. Its declaration returns a long int and operates on the position shared by reading and writing. section 14.6
Inspecting a stream position
long int position = ftell(stream); /* position is measured from the file start */ Used with fseek, ftell helps move forward or backward through a binary stream while fread and fwrite advance the position after successful transfers. section 14.6
size_t fread(void* restrict ptr, size_t size, size_t nmemb,
FILE* restrict stream);
size_t fwrite(void const*restrict ptr, size_t size, size_t nmemb,
FILE* restrict stream);
int fseek(FILE* stream, long int offset, int whence);
long int ftell(FILE* stream);
The related declarations place ftell beside fread, fwrite, and fseek, showing the small interface used to inspect and control binary-stream positions. section 14.6
Use ftell with streams opened in binary mode when portability matters; text-mode end-of-line transformations can make binary positioning unreliable across platforms. section 14.6
