Obtains the next available keystroke from the current screen
#include <nwconio.h> int getch (void);
This function returns a value of EOF when an error is detected. Otherwise, the getch function returns the value of the keystroke (or character).
When the keystroke represents an extended key (for example, a function key, a cursor-movement key, or the Alt key with a letter or a digit), a value of 0 is returned, and the next call to getch returns a value for the extended function. When an error occurs, errno is set.
The getch function reads from the current screen. Nothing is echoed on the screen ( getche echoes the keystroke, if possible). When no keystroke is available, the function waits until a key is depressed.
Use the kbhit function to determine if a keystroke is available.
#include <nwconio.h> main () { int keyStroke; keyStroke = getch (); }