Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Mar 29th, 2012  |  syntax: D  |  size: 0.61 KB  |  views: 68  |  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. module test;
  2.  
  3. import std.stdio;
  4. import core.sys.posix.termios;
  5. import core.sys.posix.unistd;
  6.  
  7. alias core.stdc.stdio.fileno fileno;
  8. alias core.stdc.stdio.stdin stdin;
  9.  
  10. termios savedterm;
  11.  
  12. void initterm ()
  13. {
  14.         termios outterm;
  15.  
  16.     setbuf(stdin, null);
  17.     tcgetattr(fileno(stdin), &savedterm);
  18.     outterm=savedterm;
  19.     outterm.c_lflag &= ~(ECHO | ICANON);
  20.     outterm.c_iflag &= ~ICRNL;
  21.     outterm.c_cc[VMIN]=1;
  22.     outterm.c_cc[VTIME]=0;
  23.     tcsetattr(fileno(stdin), TCSANOW, &outterm);
  24. }
  25.  
  26. void main ()
  27. {
  28.     char c;
  29.  
  30.     initterm();
  31.     read(fileno(stdin), &c, 1);
  32.     writeln("***********");
  33. }
clone this paste RAW Paste Data