~riderius/cpp-code

cpp-code/keylog.cpp -rw-r--r-- 404 bytes
380d65aariderius digits_analysis.cpp: argv[1] can replace n 11 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <locale>
#include <ncurses.h>

int main(void) {
  setlocale(LC_ALL, "");
  initscr();
  clear();
  noecho();
  raw();

  printw("Enter a symbol\nExit: ^C");
  refresh();
  wchar_t ch;
  WINDOW *win = newwin(LINES / 2 - 1, COLS / 2 - 4, LINES / 2 - 1, COLS / 2 - 4);
  while ((ch = wgetch(win)) != 3) {
    wclear(win);
    wprintw(win, "%s = %d", keyname(ch), ch);
  }
  endwin();
  return 0;
}