by Dinesh Thakur Category: C Programming (Pratical)

 

#include<stdio.h>

void main(int argc,char*argv[])
{
      FILE *f1;
      char ch;
      int character=0;
      clrscr();
      if(argc!=2)
        {
            printf("Insufficient Arguments");
            exit(0);
        }
      f1=fopen(argv[1],"r");
      if(f1==NULL)
        {
            printf("Source Can't be Opened");
            exit(0);
        }
            ch=fgetc(f1);
            while(ch!=EOF)
                  {
                       character++;
                       ch=fgetc(f1);
                  }
                       fclose(f1);
                       printf("No: of Characters are : %d",character);
                       getch();
}
About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content