纯干货:
#include <unistd.h>
#include <stdlib.h>
#include <curses.h>
#define LOCAL_ESCAPE_KEY 27
int main()
{
int key;
initscr();
crmode();
keypad(stdscr, TRUE);
noecho();
clear();
mvprintw(5,5,"key pad demonstration. press 'q' to quit");
while(key != ERR && key != 'q')
{
move(7,5);
clrtoeol();
if((key >= 'A' && key <= 'Z') || (key >='a') && (key <= 'z'))
{
printw("Key was %c",(char)key);
}
else
{