Click to See Complete Forum and Search --> : input in C++


kam
12-06-2002, 01:41 PM
I want to be able to enter data via standard input, but I don't want to have to press enter afterwards. For example, when I press 1, I want the program to immediately know I pressed 1 without pressing enter. It doesn't seem cin will let me do this, so what can I do?

bwkaz
12-06-2002, 03:24 PM
The same thing you do in C. Either reprogram the tty device using the termios stuff (there are tutorials somewhere on how to do this -- maybe www.codeexamples.org?), or use something like (n)curses, and its getch() function.

I believe (n)curses has a C++ binding.