#include <stdio.h>
#include <conio.h>
void main () {
   FILE *fp;
   int length;
   clrscr();
   fp = fopen("file.txt", "r");
   fseek(fp, 0, SEEK_END);
   length = ftell(fp); // return current position
   fclose(fp);
   printf("File size: %d bytes", length);
   getch();
}
// output
// file size: 18 bytes
Comments