#include <stdio.h>
#include <termios.h>
int getch(void);
int main ()
{
int ch = getch();
printf("<%d>", ch);
return 0;
}
int getch(void)
{
struct termios oldMode, newMode;
int ch;
// Salvando
tcgetattr(0, &oldMode);
newMode = oldMode;
newMode.c_lflag &= ~(ICANON | ECHO);
// Alterando
tcsetattr(0, TCSANOW, &newMode);
ch = getchar();
// Restaurando
tcsetattr(0, TCSANOW, &oldMode);
return ch;
}