/* * Another example using ncurses library. */ #include #include int prompt_and_get_ch(void); int main(void) { int ch; initscr(); raw(); keypad(stdscr, TRUE); noecho(); while ((ch = prompt_and_get_ch()) != KEY_F(1)) { printw("The pressed key is "); attron(A_BOLD); printw("%c\n", ch); attroff(A_BOLD); } endwin(); return EXIT_SUCCESS; } int prompt_and_get_ch(void) { printw("Type any character (F1 to end)\n"); return getch(); }