/* Count characters of file */
#include<stdio.h>
int main()
{
FILE *fp;
char a[10];
long cnt=0;
int c;
printf("Type a file name : ");
gets(a);
if((fp=fopen(a,"r"))==NULL)
printf("File dosen't exist.");
else
{
while(1)
{
c=fgetc(fp);
if(feof(fp)) break;
cnt++;
}
printf("\nfile have %ld characters",cnt);
}
fclose(fp);
return 0;
}
This Blog is All about various C & C++ programs using Graphics.h header files. The programs are Compiled using Turbo C++ & C .Here i will be posting source codes of programs in C or C++ or Computer Graphics
Count characters of file
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment