I use scanf()to read user input on a terminal in a console application. scanf waits until the user runs the return key for reading. Is there a way to read user input every time I press a key?
scanf()
The usual way would be to use a function getchfrom (Mac port) ncurses .
getch
Note that while getcharreading a single character, it still usually performs buffering, so you need to press return / enter before it returns.
getchar
getch() stdin .
getch()
char c = getchar();
He has to do the trick.