#include<curses.h>
int main()
{
int key;
initscr();
keypad(stdscr,1);//获取功能键,即上下左右键
// printw("This is a test!\n");
while(1){
key = getch();
switch(key){
case KEY_DOWN:
printw("DOWN\n");
break;
case KEY_UP:
printw("UP\n");
break;
case KEY_LEFT:
printw("LEFT\n");
break;
case KEY_RIGHT:
printw("RIGHT\n");
break;
}
}
endwin();
return 0;
}
ncurse上下左右键获取
最新推荐文章于 2023-04-26 21:45:33 发布