Skip to main content
Write a program to find size of the file.
CODING:
#include<stdio.h>
#include<conio.h>
void main()
{
FILE *fp;
char ch[10];
int size=0;
clrscr();
printf("Enter File Name:");
scanf("%s",&ch);

fp=fopen(ch,"r");
if(fp==NULL)
{
 printf("\nFile Cant' be opend.");
}
else
{
 printf("\nFile Opened.");
}

fseek(fp,0,2);
size=ftell(fp);
printf("\nThe size Of FILE %s:%d\n",ch,size);
fclose(fp);
getch();

}

Comments