Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Reading in characters from file

$
0
0
I'm trying to pass a file name to a function which in turn reads in the file's characters one at a time and stores their frequency in an array of 0-127...so say the first character is a, and a's element in the array is 5, then the fifth element would increment by 1 and then the next character would be read in and the corresponding element in the array would be incremented as well. But I'm a beginner when it comes to file IO in C so help and explanation would be greatly appreciated. Here is what I have thus far:


	void createFrequencyTable(char* filename) {
		FILE *f;
		f = fopen(filename, "r");

		while(f != EOF){
			scanf(f, 
		}
	
	}


Viewing all articles
Browse latest Browse all 51036

Trending Articles