Q: Storing each character from text file First, Sorry I'm not good in using english
THIS MY OUTPUT
you just read : abcdefg4523 hij

you just read : 234kl  monp

you just read : qrs tuv

you just read : wx 452 z

This file have 4 alphabets 

Last line counts the lines I have instead
I want to count only the alphabet and that my output would print  "This file have 26 alphabets" (see my file at the bottom)
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define INPUT "file.txt"
#define MAX 1024
int main(void)
{
    FILE *pIn;
    int count = 0 ;
    char inputBuffer[MAX];
    char alphabet[MAX];
    pIn=fopen(INPUT,"r");
    while (fgets(inputBuffer,sizeof(inputBuffer),pIn) != NULL)
    {
        printf("you just read : %s",inputBuffer);
        count++;
    }
    fclose(pIn);
    printf("\nThis file have %d alphabets\n",count);
    return 0;

}

ABOUT MY FILE.txt:
abcdefg4523 hij

234kl  monp

qrs tuv

wx 45y2 z


A: You could use getc() or fgetc() and check if isalpha().
int c;
size_t count = 0;

...

c = fgetc(filehandle)
if (isalpha(c))
    ++count;


If the input can be wide bytes, you could use fgetwc() instead and check by iswalpha().
Then you also have to ensure that locale is set:
setlocale(LC_ALL, "");

Or you could check the upper bits if you only want to count length of all characters.
if ((c & 0xc0) != 0x80) 
    ...


Another way could be to use an array to collect stats, and calculate/check things afterward.
E.g. (ASCII only):
#include <stdio.h>
#include <ctype.h>

void print_stats(unsigned int cc[256])
{
    int i;
    size_t sum = 0;

    fprintf(stdout,
        "----------------\n"
        "Stats all bytes:\n"
        "----------------\n"
    );
    for (i = 0; i < 256; ++i) {
        sum += cc[i];
        if (cc[i]) {
            if (isprint(i))
                fprintf(stdout, "%c   : %d\n", i, cc[i]);
            else
                fprintf(stdout, "0x%02x: %d\n", i, cc[i]);

        }
    }
    fprintf(stdout, "Total: %u bytes.\n", sum);
}

void print_stats_alpha(unsigned int cc[256])
{
    int i;
    size_t sum = 0;

    fprintf(stdout,
        "------------------\n"
        "Stats alpha bytes:\n"
        "------------------\n"
    );
    for (i = 0; i < 256; ++i) {
        if (cc[i] && isalpha(i)) {
            sum += cc[i];
            fprintf(stdout,
                "%c: %d\n",
                (char)i, cc[i]
            );
        }
    }
    fprintf(stdout, "Total: %u alpha bytes.\n", sum);
}

int main(int argc, char *argv[])
{
    FILE *fh;
    unsigned int cchar[256] = {0};
    int c;

    if (argc == 1) {
        fprintf(stderr, "Usage: %s <file>\n", argv[0]);
        return 1;
    }

    if (!(fh = fopen(argv[1], "r"))) {
        perror(argv[1]);
        return 1;
    }


    while ((c = getc(fh)) != EOF) {
        ++cchar[c];
    }

    fclose(fh);

    print_stats(cchar);

    print_stats_alpha(cchar);

    return 0;
}


A: I got the point @Barbiyong. You want to count the number of alphabet characters in the input file you are passing. But for that functionality why are you making use of fgets() function? As the function name itself says, it will read the input as a string and output it. There is another function called fgetc() for that. Refer to the code below for your understanding and make changes accordingly.
c=fgetc(pIn);
if isaplpha(c)
{
  printf("Encountered alphabet:%c",char(c));
  count++;
}

