您的位置:首页 > 其它

curses库显示函数基本用法样例

2014-05-24 14:51 232 查看
/* curses test
 * file name: cursestest.c
 * cmd: gcc cursestest.c -lcurses
 * author: yilonglucky#gmail.com
 */
#include <stdio.h>
#include <curses.h>

int main()
{
    initscr();
    
    /* bold */
    move(10, 20);
    attron(A_BOLD);
    addstr("Hello, ");
    
    refresh();
    sleep(1);
    
    /* bold + underline */
    attron(A_UNDERLINE);
    addstr("world!");
    
    refresh();
    sleep(1);
    
    /* underline */
    move(11, 20);
    attroff(A_BOLD);
    addstr("Hello, ");
    
    refresh();
    sleep(1);
    
    /* normal */
    attroff(A_UNDERLINE);
    addstr("world!");
    
    refresh();
    sleep(1);
    
    /* highlight */
    move(12, 20);
    standout();
    addstr("Hello, world!");
    standend();
    
    refresh();
    sleep(1);
    
    sleep(10);
    endwin();
    return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: