![]() |
VOOZH | about |
In C, ftell() is used to determine the position of the file pointer in the file from the beginning of the file.
The ftell() function is declared in the <stdio.h> header file.
Suppose the file g4g.txt contains the following data:
g4g.txt
Someone over there is calling you. We are going for work. Take care of yourself.Output
7Explanation
In the above program the fscanf() function reads the first word from the file ('Someone') and the pointer moves forward. As the length of "someone" is 7 and the character indices are from 0 to 6. ftell(fp) returns 7.