Here it is, my original! (I warn you, this maybe a little long winded, but I've only been learning c for about... 6 months, but it works like a dream apart from displaying the french characters!):
PS: R u comparing your version you've done bfore to mine?? Well, you win, I garantee it.
Code:
void letterfrequencies (char *location)
{
printf("\n\n\tLetter | Frequency");
printf("\n\t--------------------");
int n,freq[256];
int count=0;
FILE *text;
for (n = 0; n <= 255; n++)
freq[n] = 0;
text=fopen(location,"r");
char * string;
size_t string_size;
string_size = totalcharacters(location);
string = (char *) malloc(string_size); //Makes sure that the length of a word cannot be greater than the number of characters in the file!
unsigned char ch;
while((fgets (string, string_size, text)) != NULL)
{
for(count=0;(string[count]!=NULL);count++)
{
ch = (unsigned char) string[count];
if ((ch>='\0')&&(ch<='?')) ; //only filters letters of words characters
else
{
freq[ch]++;
}
}
}
for(n=0;n<=255;n++)
{
if (freq[n]!=0)
printf("\n\t%c | %i",n,freq[n]);
else
; //do nothing
}
//do printf statements of description of charcters that DOS displays wrong if unable to reslove the frenchy charter problem
fclose (text);
}