zoukankan      html  css  js  c++  java
  • linux 画图程序测试三

    该程序显示字符左右移动

    /**
    * curses3.c
    */
    #include
    <stdio.h>
    #include
    <curses.h>
    #include
    <sys/ioctl.h>
    #include
    <signal.h>
    void restandend();
    int main(int ac,char *av[])
    {
    struct winsize wbuf;
    int rows,cols;
    int dir=+3,pos=0;
    //signal(SIGINT,restandend);
    if(ioctl(0,TIOCGWINSZ,&wbuf)!=-1)
    {
            rows
    =wbuf.ws_row;
            cols
    =wbuf.ws_col;
    }
    rows
    =10;
    //printf("row=%d col=%d\n",rows,cols);
    initscr();
    while(1)
    {
            move(rows,pos);
            addstr(
    "cartoon");
            
    if(pos>(cols-9&& dir==+3)
                    dir
    =-3;
            
    if(pos<=0 && dir==-3)
                    dir
    =+3;
            sleep(
    1);
            refresh();
            move(rows,pos);
            addstr(
    "       ");
            pos
    +=dir;
    }
    standend();
    return 0;
    }
    void restandend()
    {
    move(
    0,0);
    addstr(
    "exit");
    refresh();
    standend();
    exit(
    1);
    }
  • 相关阅读:
    响应式布局
    CSS3过渡
    CSS3背景
    CSS渐变
    CSS3选择器
    CSS3
    自定义指令
    键盘修饰符
    过滤器
    v-if与v-show区别
  • 原文地址:https://www.cnblogs.com/ringwang/p/1429906.html
Copyright © 2011-2022 走看看