Advertisement
Sam-Sampaio

Termios

Mar 17th, 2019
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <termios.h>        
  3. #include <unistd.h>    
  4.  
  5. int main(void){  
  6.     static struct termios tc, newx;
  7.     tcgetattr( STDIN_FILENO, &tc);
  8.     newx = tc;
  9.  
  10.     newx.c_lflag &= ~(ICANON | ECHO);
  11.  
  12.     tcsetattr( STDIN_FILENO, TCSANOW, &newx);
  13.  
  14.     while(getchar() == 'a')      
  15.         printf("teste");                
  16.  
  17.     tcsetattr( STDIN_FILENO, TCSANOW, &tc);
  18.  
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement