#include <stdio.h>

int  main()
{
    struct Count
    {
        int c;
        int count;
    };
    struct Count counter[256];
    int i=0;
    for(i=0;i<256;i++) {counter[i].c=i;counter[i].count=0;}
    FILE* fp;
    fp=fopen("d:\\b.txt","r");
    char flag=0xA;
    int lines=0;
    char tline[256]={'\0'};
    char* cp=tline;
    char tmp;
    while(!feof(fp))
    {
        tmp=getc(fp);
        counter[tmp].count++;
    }
    int _chars=0;
    for(i=0;i<256;i++)
    {
        if(counter[i].count>0) 
        {
            _chars+=counter[i].count;
            if(i==0xA)   //\n
            {
                printf("\\n  Number of occurrences=%d\n",counter[i].count);
            }
            else
                if(i==0x20)  //space
                {
                    printf("space Number of occurrences=%d\n",counter[i].count);
                }
                else
                    if(i==0x9)  //\t
                    {
                        printf("\\t  Number of occurrences=%d\n",counter[i].count);
                    }
                    else
                        if(i==0x0)  //NULL
                        {
                            printf("NULL  Number of occurrences=%d\n",counter[i].count);
                        }
                        else 
                            if(i==0xD)  //
                            {
                                printf("OxD  Number of occurrences=%d\n",counter[i].count);
                            }
                            else  /*Visible characters*/printf("%c  Number of occurrences=%d\n",i,counter[i].count);
        }
    }
    printf("File the total number of characters=%d\n",_chars);
    fclose(fp);
    return 0;
}