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;
- char pressed;
- tcgetattr(0, &termparams);
- termparams.c_lflag &= ~(ECHO | ICANON);
- termparams.c_cc[VTIME] = 0;
- tcsetattr(0, TCSANOW, &termparams);
- read(0, &pressed , 1);
- printf("Button pressed: %s", pressed);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement