Advertisement
Guest User

Untitled

a guest
Mar 29th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <termios.h>
  3. #include <unistd.h>
  4.  
  5. struct termios savedterm;
  6.  
  7. void initterm ()
  8. {
  9.     struct termios outterm;
  10.  
  11.     setbuf(stdin, NULL);
  12.     tcgetattr(fileno(stdin), &savedterm);
  13.     outterm=savedterm;
  14.     outterm.c_lflag &= ~(ECHO | ICANON);
  15.     outterm.c_iflag &= ~ICRNL;
  16.     outterm.c_cc[VMIN]=1;
  17.     outterm.c_cc[VTIME]=0;
  18.     tcsetattr(fileno(stdin), TCSANOW, &outterm);
  19. }
  20.  
  21. int main (int argc, const char *argv[])
  22. {
  23.     initterm();
  24.     char c;
  25.     read(fileno(stdin), &c, 1);
  26.     printf("**********\n");
  27.    
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement