user3671292
user3671292

Reputation: 83

How can i write text in c++ console without breaking the lines

how can i input text in c++ console without breaking the input in one line at a time? If i use cin i can input one string each time plus i cannot edit the input (except if i edit the string but this wont help) Is there any way to input strings (with multiple lines) but not to break the string in one line at a time?

I am running ubuntu 12.04

Upvotes: 0

Views: 413

Answers (1)

Who is writing? Is it you, or some program??

Your terminology is unusual: generally programmers take the point of view of the computer!

What you write by typing on your keyboard is an input to some program (which reads it).

If you want an editable input (to the program, so "written" or typed by the human user), consider using GNU readline (on Linux), or perhaps ncurses

If you want to format the program's output (which the user would read with his eyes), you'll generally need to code that formatting explicitly. Perhaps ANSI escape codes might be useful (but using them might make readline or ncurses unhappy).

See also this answer and the references I gave there.

Upvotes: 1

Related Questions