How to get Ctrl, Shift or Alt with getch()
ncurses ?
I cannot get it work to get Ctrl, Shift or
At least for the control modifier there is a simple solution. Curses had been derived from vi source code, in which you find the following (see https://github.com/n-t-roff/ex-1.1/blob/master/ex.h line 77 and https://github.com/n-t-roff/ex-1.1/blob/master/ex_vops.c line 445):
#ifndef CTRL
#define CTRL(c) ((c) & 037)
#endif
switch(getch()) {
case CTRL('r'):
/* key ctrl-r (i.e. ^R) pressed */
Dependend on used includes CTRL
may or may not already been defined in your code.