Counting number of character in file !

#include <stdio.h>
#include <conio.h>
#include <string.h>

int main(void)
{
    char ch[100];
    FILE *p;
    p = fopen("text.txt""w+");
    printf("Enter the text to store in file : ");
    gets(ch);
    fputs(chp);
    fclose(p);

    // --------------------------------------------------------------
    //counting number of character in file
    int lenght = 0;
    p = fopen("text.txt""r");
    while (!feof(p))
    {
        fgets(ch100p);
        lenght = strlen(ch);
    }
    printf("Number of Character in file is %d"lenght);
    fclose(p);
    //----------------------------------------------------------------
}
SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment