daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Mar 24th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <termios.h>
  2. #include <unistd.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. int main () {
  7.         struct termios termparams;
  8.         struct termios* termparams_p;
  9.         char pressed;
  10.         char* pressed_p;
  11.         pressed_p = malloc(sizeof(char));
  12.         tcgetattr(0, termparams_p);
  13.         termparams_p->c_lflag &= ~(ECHO | ICANON);
  14.         termparams_p->c_cc[VTIME] = 0;
  15.         tcsetattr(0, TCSANOW, termparams_p);
  16.         read(0, pressed_p , 1);
  17.         printf("Button pressed: %s", pressed);
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top