|
|
#include <ocurses.h>NOTESint getch()
EXAMPLE
#include <ocurses.h>main() { int ch;
initscr(); cbreak(); /* Explained later in the section "Input Options" */ addstr("Press any character: "); refresh(); ch = getch(); printw("\n\n\nThe character entered was a '%c'.\n", ch); refresh(); endwin(); }
The output from this program follows. The first refresh sends the addstr character string from stdscr to the terminal:
Press any character: []
Now assume that a w is typed at the keyboard. getch accepts the character and assigns it to ch. Finally, the second refresh is called and the screen appears as follows:
Press any character: w The character entered was a 'w'. $[]
For another example of getch, see ``The show program''.