-
inputing keys
Code:
#include <curses.h>
int main(int argc, char *argv[])
{
initscr();
raw();
int a = getch();
printf(%d, a);
getch();
endwin();
return 0;
}
i need to input a key and print not the char but the hex or octal code so that i can determine the code for the esc key.
i want my getch() command to respond to the esc key, but it does not seem to when i use \1B
-
Code:
printf("Oct: %o Hex: %x\n",a,a);
Or, since this is the C++ board:
Code:
#include <iostream>
#include <iomanip>
...
std::cout << "Oct: " << std::oct << a << " Hex: " << std::hex << a << std::endl;