SHARE
TWEET

Untitled

a guest Mar 24th, 2019 56 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.         char pressed;
  9.         tcgetattr(0, &termparams);
  10.         termparams.c_lflag &= ~(ECHO | ICANON);
  11.         termparams.c_cc[VTIME] = 0;
  12.         tcsetattr(0, TCSANOW, &termparams);
  13.         read(0, &pressed , 1);
  14.         printf("Button pressed: %s", pressed);
  15. }
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