How can I output erasable text in C ++ for the console?

I remember that I saw completed programs in which you could cancel and delete text prompts. Usually all cout'ed text is static and cannot be removed from the screen, but I want to remove the text that was displayed by the program (for example, the program gives me a default name, which I can accept or delete and enter my own). I would suggest that I can fake keyboard input to apply erasable text to the console, but is there a cleaner way to do this? Thanks.

+4
source share
1 answer

If I understand you, you probably want something like the GNU Readline

β€œThe GNU Readline library provides a set of functions for using the application that allow users to edit when they are entered. Both Emacs and vi editing modes are available. The Readline library includes additional functions for saving a list of previously entered command lines to recall and possibly repeat these lines and run the csh-like history extension on the previous Command. "

+3
source

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


All Articles