Created
September 28, 2019 23:10
-
-
Save gagbo/c5ab3b3a5d8b11eb47ab8879745acf69 to your computer and use it in GitHub Desktop.
Get keycodes in terminal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <curses.h> | |
#include <ncurses.h> | |
#include <locale.h> | |
#include <wchar.h> | |
int main() | |
{ | |
setlocale(LC_CTYPE, ""); initscr(); raw(); noecho(); keypad(stdscr, TRUE); | |
wint_t c; | |
get_wch(&c); | |
endwin(); | |
printf("Keycode: %d\n", c); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment