end of line command

This is a discussion on end of line command within the C++ Programming forums, part of the General Programming Boards category; Hi all, I was wondering if, when reading from a file, there is a way (or an algorithm) to check ...

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    64

    end of line command

    Hi all,

    I was wondering if, when reading from a file, there is a way (or an algorithm) to check if you reached the end of a line.

    Thanks.

  2. #2
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    Sorry I thought you said end of file. -ashamed- You'd probably get a '\n' character at the end of a line. Just use the getline() function and that will read in a whole line.
    Last edited by jmd15; 08-27-2006 at 04:52 PM.
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

  3. #3
    Registered User
    Join Date
    Jul 2005
    Posts
    64
    I thought eof() was the end-of-file condition. I need something to check if you reached the end of a line.

  4. #4
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    use
    Code:
    getline( cin, string_var, '\n' );
    That will read until a newline character is presented

  5. #5
    Registered User
    Join Date
    Jul 2005
    Posts
    64
    Thanks. I'll let you know how it works.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Run MFC exe from Command Line
    By magic.mike in forum Windows Programming
    Replies: 6
    Last Post: 09-08-2005, 03:00 PM
  2. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 04:30 PM
  3. how to check for end of line in a text file
    By anooj123 in forum C++ Programming
    Replies: 6
    Last Post: 10-25-2002, 12:21 AM
  4. command line "shell"
    By mart_man00 in forum C Programming
    Replies: 3
    Last Post: 09-29-2002, 02:29 AM
  5. CLI (Command Line Interperator)
    By Mark in forum C Programming
    Replies: 3
    Last Post: 08-31-2001, 07:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21