ftell() function in c is used to get the total size of file after move the file pointer to the end of the file and it return the current position in long type.
File can have more than 32767 bytes of data
Syntax : -
long int ftell(FILE *stream)
Let's Check out the Program for ftell() function in c programming.
#include<stdio.h> #include <conio.h> void main () { FILE *f; int len; f = fopen("one.txt", "r"); if(f == NULL) { perror(“Error opening file”); return(-1); } fseek(f, 0, SEEK_END); len = ftell(f); fclose(f); printf("Size of file: %d bytes", len); getch(); }
OUTPUT For ftell() function program
ftell() in c |