ftell() function in File handling by R4R Team

ftell() is the function that return the current position of the file pointer.

Syntax-
ftell(file_pointer);
-It return integer number


program-

#include< stdio.h>
void main()
{
FILE *fp;
char ch;
int i;
//open file in read mode
fp=fopen("myfile.txt","r");
//Now read 5 character only
for(i=0;i< 5;i++)
{
c=fgetc(fp);
printf("%c",c);
}
printf("Now ftell return the %d",ftell(fp));
fclose(fp);// close file
}


output-

5




Leave a Comment: