38 lines
531 B
C
38 lines
531 B
C
#include <ncurses.h>
|
|
|
|
void _do_setup(){
|
|
initscr();
|
|
raw();
|
|
keypad(stdscr, TRUE);
|
|
noecho();
|
|
}
|
|
|
|
|
|
void _display_and_quit(){
|
|
refresh();
|
|
getch();
|
|
endwin();
|
|
}
|
|
|
|
|
|
int main()
|
|
{
|
|
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 ");
|
|
attron(A_BOLD);
|
|
printw("%c", ch);
|
|
attroff(A_BOLD);
|
|
}
|
|
|
|
_display_and_quit();
|
|
|
|
return 0;
|
|
}
|