getch(CURSES)
getch --
get a single-byte character from the terminal
Synopsis
cc [options] file -lcurses
#include <curses.h>
int getch(void);
int mvgetch(int y, int x);
int mvwgetch(WINDOW *win, int y, int x);
int wgetch(WINDOW *win);
Description
These functions read a single-byte character from the terminal associated with
the current or specified window.
If
keypad(CURSES)
is enabled, these functions respond to the pressing of a function key by
returning the corresponding KEY_ value defined in
curses.h.
Processing of terminal input is subject to the general rules described in
``Input Processing''.
If the current or specified window is not a pad, and it has been moved or
modified since the last refresh operation, then it will be refreshed before
another character is read.
Return value
Upon successful completion
getch(CURSES),
mvgetch(CURSES),
mvwgetch(CURSES)
and
wgetch(CURSES)
return the single-byte character, KEY_ value, or ERR.
When in the nodelay mode and no data is available, ERR is returned.
Errors
No errors are defined.
Usage
Applications should not define the escape key by itself as a single-character
function.
When using these functions,
nocbreak(CURSES)
mode
and
echo(CURSES)
mode should not be used at the same time.
Depending on the state of the terminal
when each character is typed, the program may produce undesirable results.
Standards Conformance
The Single UNIX Specification, Version 2; The Open Group.
References
``Input Processing''.
cbreak(CURSES),
doupdate(CURSES),
insch(CURSES),
curses(F)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005