Counting characters in a buffer
-
Ok im trying to count the characters that i have loaded into a buffer i have set up the following function void countchars(char *buffer, int *count) /*Counts the number of characters in the text file */ { int i,counter; char cdata; count['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']; do { { for(cdata='A';cdata<='Z';cdata++) if(buffer[i]==counter[count]) { count++; } i++; } }while(buffer[i]!=EOF); } I am calling this function using the following code: countchars(buffer,cdata); printf("\nDistribution of letters in %s is:",fname); for (c='A';c<='Z';c++) { N=cdata[c]+cdata[tolower(c)]; printf("\n'%c' %4d: ",c,N); for (i=0;i
-
Ok im trying to count the characters that i have loaded into a buffer i have set up the following function void countchars(char *buffer, int *count) /*Counts the number of characters in the text file */ { int i,counter; char cdata; count['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']; do { { for(cdata='A';cdata<='Z';cdata++) if(buffer[i]==counter[count]) { count++; } i++; } }while(buffer[i]!=EOF); } I am calling this function using the following code: countchars(buffer,cdata); printf("\nDistribution of letters in %s is:",fname); for (c='A';c<='Z';c++) { N=cdata[c]+cdata[tolower(c)]; printf("\n'%c' %4d: ",c,N); for (i=0;i
-
:laugh: Do your own homework, Overfiend. Member since Wednesday 9th April, 2003 8:32 10 Apr '03 Counting characters in a buffer - Overfiend Visual C++ (Programming Forums) 6:31 10 Apr '03 Counting characters in a buffer - Overfiend C# (Programming Forums) 10:42 9 Apr '03 Counting characters from a text file - Overfiend Visual C++ (Programming Forums)
-
:laugh: Do your own homework, Overfiend. Member since Wednesday 9th April, 2003 8:32 10 Apr '03 Counting characters in a buffer - Overfiend Visual C++ (Programming Forums) 6:31 10 Apr '03 Counting characters in a buffer - Overfiend C# (Programming Forums) 10:42 9 Apr '03 Counting characters from a text file - Overfiend Visual C++ (Programming Forums)