2009-11-19 00:38:43 +00:00
|
|
|
#include <ncurses.h>
|
|
|
|
|
2009-11-19 00:57:50 +00:00
|
|
|
void _do_setup(){
|
|
|
|
initscr();
|
|
|
|
raw();
|
|
|
|
keypad(stdscr, TRUE);
|
|
|
|
noecho();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _display_and_quit(){
|
|
|
|
refresh();
|
|
|
|
getch();
|
|
|
|
endwin();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-19 00:38:43 +00:00
|
|
|
int main()
|
2009-11-19 00:57:50 +00:00
|
|
|
{
|
|
|
|
int ch;
|
|
|
|
_do_setup();
|
|
|
|
|
|
|
|
printw("Type any character to see it in bold\n");
|
|
|
|
ch = getch();
|
|
|
|
if(ch == KEY_F(1)){
|
|
|
|
printw("F1 Key pressed");
|
|
|
|
} else {
|
|
|
|
printw("The pressed key is ");
|
2009-11-19 00:38:43 +00:00
|
|
|
attron(A_BOLD);
|
|
|
|
printw("%c", ch);
|
|
|
|
attroff(A_BOLD);
|
|
|
|
}
|
2009-11-19 00:57:50 +00:00
|
|
|
|
|
|
|
_display_and_quit();
|
2009-11-19 00:38:43 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|