How to get Ctrl, Shift or Alt with getch()
ncurses ?
I cannot get it work to get Ctrl, Shift or
You can call key_name( c )
to turn the key generated from getch()
into something that shows you the state of the ctrl-modifier.
For example this code shows "^R" if you press ctrl-r:
while( true )
{
char c = getch();
if ( ERR == c )
break;
const char *name = key_name( c );
move( 2, 2 );
clear();
printw( "You entered: %s ", name );
refresh();
}