Chinaunix首页 | 论坛 | 博客
  • 博客访问: 49367
  • 博文数量: 25
  • 博客积分: 960
  • 博客等级: 准尉
  • 技术积分: 280
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-14 12:39
文章分类
文章存档

2011年(1)

2009年(20)

2008年(4)

我的朋友

分类: C/C++

2009-06-03 14:27:12

#include
#include
#include
#define StartX 2
#define StartY 2
void initial()
{
 initscr();
 cbreak();
 nonl();
 noecho();
 intrflush(stdscr,FALSE);
 keypad(stdscr,TRUE);
 refresh();
}
main()
{
 int x=StartX;
 int y=StartY;
 int ch;
 initial();
 box(stdscr,'|','-');
 attron(A_REVERSE);
 mvaddstr(0,20,"编辑器");
 attroff(A_REVERSE);
/*
 mvaddstr(2,10,"姓名:");
 attron(A_UNDERLINE);
 mvaddstr(2,15,"");
 attroff(A_UNDERLINE);
 mvaddstr(3,10,"密码:");
 attron(A_UNDERLINE);
 mvaddstr(3,15,"");
 attroff(A_UNDERLINE);
*/
        move(x,y);
        do{
                ch=getch();
                switch(ch)
                        {
                        case KEY_UP:
                                --y;
                                break;
                        case KEY_DOWN:
                                ++y;
                                break;
                        case KEY_RIGHT:
                                ++x;
                                break;
                        case KEY_LEFT:
                                --x;
                                break;
                        case '\r':
                                ++y;
                                x=2;
                                break;
                        case '\t':
                                x+=7;
                                break;
                        case 127:
                                mvaddch(y,--x,' ');
                                break;
                        case 27:
                                endwin();
                                exit(1);
                        default:
                                addch(ch);
                                x++;
                                break;
                        }
                        move(y,x);
        }while(1);

}
阅读(576) | 评论(0) | 转发(0) |
0

上一篇:esql delete

下一篇:我的考查esql

给主人留下些什么吧!~~