char *s;
long length;
int i, cent = 0, ctab = 0, cspa = 0, cnum = 0;
FILE *in = fopen("text.txt", "rb");
fseek(in, 0L, SEEK_END);
length = ftell(stream);
fseek(stream, 0L, SEEK_SET);
if(s = (char*)malloc(length) != NULL)
{
fread(s, length, 1, in);
for(i = 0; i < length; ++i)
{
if(s[i] == '\n') ++cent;
else if(s[i] == '\t') ++ctab;
else if(s[i] == ' ') ++cspa;
else if(isdigit(s[i])) ++cnum;
}
printf("Enter: %d Tab: %d, Space: %d Digit %d Letter", cent, ctab, cspa, cnum, length - ctab - cspa - cnum);
free(s);
}
fclose(in);