A question about getline

This is a discussion on A question about getline within the C++ Programming forums, part of the General Programming Boards category; Could someone tell me what can be wrong with my vc++ installation? when I use getline as for example: getline(cin,name,'\n'); ...

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    7

    A question about getline

    Could someone tell me what can be wrong with
    my vc++ installation?
    when I use getline as for example:

    getline(cin,name,'\n');

    I have to press twice ENTER.
    Why is that?

    and also, how do I use flush? what is the working of it?
    what is what it does? When do I need it, and when I don't?
    Last edited by jriano; 06-24-2003 at 12:17 AM.

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493

    Re: A question about getline

    Originally posted by jriano
    Could someone tell me what can be wrong with
    my vc++ installation?
    when I use getline as for example:

    getline(cin,name,'\n');

    I have to press twice ENTER.
    Why is that?

    and also, how do I use flush? what is the working of it?
    what is what it does? When do I need it, and when I don't?
    Flushing can be done automatically with std::endl. I think there's also an ostream that flushes only.

  3. #3
    Registered User
    Join Date
    May 2003
    Posts
    148
    That is a bug in getline in the STL implementation.
    Here is the fix Kilck

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question About Getline
    By bengreenwood in forum C++ Programming
    Replies: 2
    Last Post: 04-28-2009, 05:13 PM
  2. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 12:14 PM
  3. getline question
    By Swaine777 in forum C++ Programming
    Replies: 2
    Last Post: 03-30-2003, 05:17 AM
  4. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 08:22 PM
  5. getline question
    By Kings in forum C++ Programming
    Replies: 9
    Last Post: 01-20-2003, 12:01 PM

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