/***************************************************************
*gcc curses.c -o curses -lcurses
*author@boker@20140113
*http://baike.baidu.com/link?url=mn9rn3Mz5X5AYTHgVV9X6mphFhgt_36I8AatPPaCampsV5V*A41k3kmXFhZ67C7bpPZKPpID6Ifx147wy7yEPzK
*http://www.ibm.com/developerworks/cn/aix/library/au-shellcurses/index.html
****************************************************************/
#include<curses.h>
int
main()
{
initscr();/*init screen*/
if(start_color()==OK)
{
init_pair(1,COLOR_RED,COLOR_GREEN);/*init color pair*/
attron(COLOR_PAIR(1));/*start color show*/
move(LINES/2,COLS/2);/*move the cursor to the center */
waddstr(stdscr,"font color is red,background is green!");
refresh();
getch();
attroff(COLOR_PAIR(1));/*close color show*/
}
else
{
waddstr(stdscr,"can not init color!");
refresh();
getch();
}
endwin();/*close curses*/
return 0;
*gcc curses.c -o curses -lcurses
*author@boker@20140113
*http://baike.baidu.com/link?url=mn9rn3Mz5X5AYTHgVV9X6mphFhgt_36I8AatPPaCampsV5V*A41k3kmXFhZ67C7bpPZKPpID6Ifx147wy7yEPzK
*http://www.ibm.com/developerworks/cn/aix/library/au-shellcurses/index.html
****************************************************************/
#include<curses.h>
int
main()
{
initscr();/*init screen*/
if(start_color()==OK)
{
init_pair(1,COLOR_RED,COLOR_GREEN);/*init color pair*/
attron(COLOR_PAIR(1));/*start color show*/
move(LINES/2,COLS/2);/*move the cursor to the center */
waddstr(stdscr,"font color is red,background is green!");
refresh();
getch();
attroff(COLOR_PAIR(1));/*close color show*/
}
else
{
waddstr(stdscr,"can not init color!");
refresh();
getch();
}
endwin();/*close curses*/
return 0;
}
效果如下: