123456789101112131415161718192021
//WINDOW *terminal; keypad( terminal, true ); //functions keys (as arrows) have a single value representation switch( getch() ){ case KEY_DOWN: echochar( 'D' ); break; case KEY_UP: echochar( 'U' ); break; case KEY_LEFT: echochar( 'L' ); break; case KEY_RIGHT: echochar( 'R' ); break; case ERR: echochar( 'E' ); break; default: echochar( 'Z' ); }