How to write text in C ++ console without breaking lines

How can I enter text into a C ++ console without interrupting input on one line at a time? If I use cin, I can enter one line each time, plus I can’t edit the input (except when I edit the line, but that doesn’t help) Is there a way to enter lines (with multiple lines) but not interrupt the line in one line at a time?

I am running ubuntu 12.04

0
source share
1 answer

Who writes? Is it you or some kind of program?

Your terminology is unusual: usually programmers understand from a computer point of view!

What you write by typing on the keyboard is the entrance to some program (which reads it).

If you want editable input (to a program so written or typed by a user), consider using the GNU read string (on Linux) or perhaps ncurses

If you want to format the output of a program (which the user would read with his own eyes), you usually need to explicitly format the code. Perhaps ANSI escape codes might be useful (but using them might make readline or ncurses invalid).

See also this answer and the links I gave there.

0
source

Source: https://habr.com/ru/post/1239268/


All Articles