Thread: std::getline problems

  1. #1
    Registered User
    Join Date
    Sep 2007

    std::getline problems

    Hi guys, here i am again with a problem.

    i am having a problem with std::getline. In my program, it made no compile time errors, but when i run it, all it do is skip over the actual line, and run whats on the next line.

    and btw, can someone tell me if they know a good free cpp debugger.

  2. #2
    Join Date
    Aug 2002
    Tucson, Arizona
    Post code.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Sounds like you've done

    cin >> someVar;

    then followed it with a getline()

    I suppose this is where you would use something like
    There are many examples of it's usage on the board.

    Of course, the better answer would be to always use getline to read input into a string, then perform whatever validation and conversion was appropriate on that string.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Oct 2007
    this wont work out smoothly...

    As suggested, POST CODE

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    Quote Originally Posted by _lazycat_ View Post
    and btw, can someone tell me if they know a good free cpp
    What compiler are you using? Most compiler packages come with a suitable debugger.

    You can get Visual Studio 2005 for free from Microsoft, which comes with a good debugger. Or if you want a Free Software model debugger, gdb is an option.

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  2. String Manipulation problems -_-
    By Astra in forum C Programming
    Replies: 5
    Last Post: 12-13-2006, 05:48 PM
  3. Rendering problems (DirectX?)
    By OnionKnight in forum Tech Board
    Replies: 0
    Last Post: 08-17-2006, 12:17 PM
  4. contest problems on my site
    By DavidP in forum Contests Board
    Replies: 4
    Last Post: 01-10-2004, 09:19 PM
  5. DJGPP problems
    By stormswift in forum C Programming
    Replies: 2
    Last Post: 02-26-2002, 04:35 PM