Contact Learn C
Copy Program Share Program

Program 361: Display File Size

Program 361: Display File Size
 
#include <stdio.h>
main(void)
{
   FILE *fp;
   char filename[80];
   long length;

   printf("Enter File name\n");
   gets(filename);
   fp=fopen(filename,"rb");

   if(fp==NULL) {
      printf("File Not Found!\n");
   }
   else {
      fseek(fp,0L,SEEK_END);
      length=ftell(fp);
      printf("Size of the file is %ldB in bytes\n",length);
      fclose(fp);
   }
}
Explanation:
Both C Program and file should be in single folder //Coming Soon


Output:

Display File Size



Display File Size


Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide