Thread: end of line.

  1. #1
    Unregistered
    Guest

    end of line.

    hi, how can i count the number of a text through a C++ program?
    this does not work.

    isn't there a command like file_name.eof();?
    but for the end of every line? like eol()?? (end of line)

    thanks.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Test for a newline character '\n'.

    -Prelude
    My best code is written with the delete key.

  3. #3
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    Well first yoy should open a file in read mode. Then increment a counter till it reached EOF i.e end of file. SO this way you have it. If you want to count the number of wards then find the blank spaces by incrementing the counter when ever " " is got before the EOF this way you get the number of words

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  2. Could somebody please help me with this C program
    By brett73 in forum C Programming
    Replies: 6
    Last Post: 11-25-2004, 02:19 AM
  3. SSCANF help
    By mattz in forum C Programming
    Replies: 7
    Last Post: 12-10-2001, 04:53 PM
  4. Validating the contents of a char buffer
    By mattz in forum C Programming
    Replies: 3
    Last Post: 12-09-2001, 06:21 PM