2
votes

I want to make something like history of commands for my console-application. It does only one thing: check for input in infinite cycle (with std::getline(std::cin, ...)). As example, you can look at gdb (console debugger). After running it we can input commands and switch them with keyboard arrows.

The question is how can I "hook" arrows pressing during waiting for input?

2

2 Answers

0
votes

Consider using GNU readline which

provides line-editing and history capabilities for interactive programs.

0
votes

If you want this for a private project or a project that will be released under a GNU license you may want to look at the GNU readline library.