I need to detect a keystroke, without the user pressing enter. What\'s the most elegant way?
I.e. If the user hits the letter Q, without pressing ent
Theres no good way to do this portably, as far as I know, other than to use a library like ncurses, which provides the getch(void) function.
ncurses
getch(void)
Note: It appears getchar(void) from stdio.h waits until the enter key is pressed then feeds your the characters,s o it won't work.
getchar(void)
stdio.h