~riderius/cpp-code

743315dd92b386bed1ad1d55719b5094bf3fab7f — RIDERIUS 6 months ago 11395c9
Exit on ^C

Signed-off-by: RIDERIUS <riderius.help@gmail.com>
1 files changed, 4 insertions(+), 3 deletions(-)

M keylog.cpp
M keylog.cpp => keylog.cpp +4 -3
@@ 6,12 6,13 @@ int main(void) {
  initscr();
  clear();
  noecho();
  raw();

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