[LBo] c/c++ one keystroke input without waiting for "Enter"

Billy Pollifrone billy at silverbaseball.com
Mon Feb 19 15:27:26 CET 2007


Loren Lockwood wrote:
> > without the user's hitting "Enter" first.  Does anybody know how to use
> > ANSI c or c++ to get a single keystroke from the keyboard without
> > waiting for the user to press "Enter"?  I have examined the iostream

Under Linux, you will have to use NCURSES to do that. The cbreak()
function tells ncurses to change to character based input. After that,
calls to getch() will return a character as soon as it is pressed.



More information about the QnA mailing list