Begining with D

Adam D. Ruppe destructionator at gmail.com
Thu Oct 10 12:36:45 PDT 2013


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.


More information about the Digitalmars-d-learn mailing list