User Tools

Site Tools


programming:ncurses

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
programming:ncurses [2022/03/19 17:38]
nanodano [Important variables and functions]
programming:ncurses [2022/03/19 23:56] (current)
nanodano
Line 309: Line 309:
  
  
 +==== Modifier keys ====
  
 +<code cpp>
 +
 +// int c = getch();
 +// switch (c)
 +case ctrl('j'): // #define ctrl(x) ((x) & 0x1f)
 + addstr("ctrl j detected");
 + break;
 +default:
 + if (c == KEY_ENTER) {
 + addstr("Keypad enter pressed.");
 + }
 + if (c == 27) { // Alt key was down when key pressed
 + // Get the next char that came with the alt
 + c = getch();
 + addstr("Alt/escaped key pressed: ");
 + addch(c); // could be 'a' or 'A' if alt+shift
 + }
 +
 +</code>
  
  
programming/ncurses.1647711538.txt.gz ยท Last modified: 2022/03/19 17:38 by nanodano