getch(3cur)
NAME
getch, mvgetch, mvwgetch, wgetch − read character
SYNTAX
getch()
wgetch(win)
WINDOW ∗win;
mvgetch(y, x)
int y, x;
mvwgetch(win, y, x)
WINDOW ∗win;
int y, x;
DESCRIPTION
The getch routine reads a character from the terminal associated with the default window.
The wgetch routine reads a character from the terminal associated with the specified window.
The routine mvgetch reads a character from the terminal associated with the default window at the specified position.
The routine mvwgetch reads a character from the terminal associated with the specified window at the specified position.
The following information applies to all the routines. In nodelay mode, if there is no input waiting, the integer ERR is returned. In delay mode, the program waits until the system passes text through to the program. Usually the program will restart after one character or after the first newline, but this depends on how cbreak is set. The character will be echoed on the designated window unless noecho has been set,
If keypad is TRUE, and a function key is pressed, the token for that function key is returned instead of the raw characters. Possible function keys are defined in the <cursesX.h> header file with integers beginning with 0401. The function key names begin with KEY_. Function keys and their respective integer values are described in the Guide to Curses Screen-Handling
If a character is received that could be the beginning of a function key (such as escape), curses sets a timer. If the remainder of the sequence does not come within the designated time, the character will be passed through, otherwise the function key value is returned. Consequently, there may be a delay after a user presses the escape key before the escape is returned to the program.
Using the escape key for a single character function is discouraged.
The routines getch, mvgetch and mvwgetch are macros.
SEE ALSO
cbreak(3cur), keypad(3cur), nodelay(3cur), noecho(3cur)
Guide to Curses Screen-Handling
Subroutines