Thread: word count

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    2

    word count

    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!!!

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    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

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    2
    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

  4. #4
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. bintree and count (withouth using template)?
    By cubimongoloid in forum C++ Programming
    Replies: 7
    Last Post: 05-24-2009, 06:22 AM
  2. Replies: 7
    Last Post: 06-16-2006, 09:23 PM
  3. word count troubles
    By Hoser83 in forum C Programming
    Replies: 13
    Last Post: 02-09-2006, 09:12 AM
  4. Replies: 5
    Last Post: 09-28-2004, 12:38 PM
  5. Word Count PlS HELP
    By Achillles in forum C++ Programming
    Replies: 12
    Last Post: 09-11-2002, 12:01 PM