ftell() - I/O Function
How is "ftell()" used in C++?
How to return current position?
is an I/O function which returns the current position of the file position indicator for the
specified stream. In binary streams this function returns the number of bytes, but in text stream an output is got using
the fseek() function. When an error occurs "-1" is returned.
long ftell(FILE * stream);
int main ()
FILE * ptr;
ptr = fopen ("freadeg.txt","r");
fseek (ptr, 0, SEEK_END);
printf ("The size of the file in bytes
The size of the file in bytes is::10
In the above example a text stream is read, the "fseek()" function
is used to pass a pointer to get the bytes read as an argument.