Next: getnstr
class of functions, Previous: Input functions, Up: Input functions [Contents][Index]
getch
The procedure getch
reads a single character from the terminal.
But there are several subtle facts to consider. For example, if you
don’t use the function cbreak!
, curses will not read your input
characters contiguously, but, will begin to read them only after
RET has been pressed or after and EOF has been
encountered. In order to avoid this, the cbreak!
function must
be used so that characters are immediately available to your program.
Another widely used function is noecho!
. As the name suggests,
when this function is set (used), the characters that are keyed in by
the user will not show up on the screen. The two functions
cbreak!
and noecho!
are typical examples of key
management.