Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Mar 29th, 2012  |  syntax: C  |  size: 0.55 KB  |  hits: 30  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }