2

When I use the normal std::cin or std::cin.get() or std::getline() functions, I get unwanted (but understandable) behaviour.

When you use the arrow keys to move back for example, you don't move back, but you input something like "^[[D" into the console.

Is there a way to make the std input function more like, let's say the Python terminal environment?

Thanks in advance!

François Andrieux
  • 28,148
  • 6
  • 56
  • 87

1 Answers1

3

No, you cannot do it with the standard library. The only approximation is outputting the backspace character \b and hope it does the right thing in the user's environment.

You will need to use either system APIs or libraries like readline or ncurses.

Acorn
  • 24,970
  • 5
  • 40
  • 69