Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <termios.h>
- #include <unistd.h>
- #include <stdio.h>
- #include <stdlib.h>
- int main () {
- struct termios termparams;
- struct termios* termparams_p;
- char pressed;
- char* pressed_p;
- pressed_p = malloc(sizeof(char));
- tcgetattr(0, termparams_p);
- termparams_p->c_lflag &= ~(ECHO | ICANON);
- termparams_p->c_cc[VTIME] = 0;
- tcsetattr(0, TCSANOW, termparams_p);
- read(0, pressed_p , 1);
- printf("Button pressed: %s", pressed);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement