Advertisement
Guest User

Untitled

a guest
Mar 29th, 2012
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.61 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement