On Saturday, 12 October 2013 at 21:27:18 UTC, 1100110 wrote:
On 10/10/2013 02:36 PM, Adam D. Ruppe wrote:
On Thursday, 10 October 2013 at 19:19:53 UTC, Ali Çehreli
wrote:
import std.c.linux.termios;
worth noting that this is Linux only. doing it on Windows is a
little
different.
Working with console/terminal input and output can get
surprisingly
complex, and doing it cross-platform is easiest with a library.
Robik's consoleD is one:
https://github.com/robik/ConsoleD/blob/master/consoled.d
it focuses on enabling color and drawing mainly, and also has
functions
to turn off the line buffering and getch().
If you use his library, you can do this:
import consoled;
void main() {
int a = getch(); // gets just one character
writecln(a); // prints back out what you got
}
and other nice things.
I had issues with getch() on ConsoleD...
If you too have issue, you can try
github.com/D-Programming-Deimos/ncurses which has similar
functions, but is also way more complex...
I guess its was on linux right? Probably because some last
quickfixes i added wasn't propely (read never) tested on linux :P
Soon I'll try to finally start working on merging terminald and
consoled somehow.