I need help! im making a programme that counts the number of words and characters in a file but have been working on it for three weeks and getting no where can anyone help!!!
Printable View
I need help! im making a programme that counts the number of words and characters in a file but have been working on it for three weeks and getting no where can anyone help!!!
well the easier task of the two is counting the characters.. have you got that part at least? if not, what have you attempted for that part?
note: no one will be helping until you show an effort with code or explanations
I have managed to count charaters but i have got it so you type a word and it count the characters you have typed but not how many characters are in a file. for example you type hello it will count 5 but if you have a hello.c file it wont count the characters in that file thats the part im struggling with. its mostly a read file problem i think
Theres a basic tutorial on working with files in C here:
http://faq.cprogramming.com/cgi-bin/...&id=1043284392
You could try using some of the code to open a file to read, then add a count in the loop to get the number of characters in the file.