You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
box-o-sand/basics/init_func_example.c

38 lines
531 B

#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;
}