tags:

views:

186

answers:

2

If I get some value by using getline( cin, myStr ); a newline is printed after the information the user entered - logically as he pressed enter:

Please enter something: ABC <enter => \n>
This text is printed out by the program and should be in the same line as before
  • How to keep the newline after user input away?

I'm using MSVC 2010 and build a simple console app using iostream and string as main libraries.

+1  A: 

You can't - the newline processing isn't controlled by the C++ program. What you can do is use the Windows console APIs to reposition the cursor after the input. Or use those APIs to write your own version of getline().

anon
+1  A: 

You can't do this using just standard C++. I'd recommend looking at PDCurses, which is a Windows-compatible replacement of NCurses.

rlbond