Sunday, October 25, 2020


Example program for ftell function in c

 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”);
   fseek(f, 0, SEEK_END);
   len = ftell(f);
   printf("Size of file: %d bytes", len);

OUTPUT For ftell() function program

ftell() function
ftell() in c


Post a Comment