Reading Standard Input

Kenneth Sills Kenneth_Sills at Verizon.net
Wed Jan 23 09:59:03 PST 2013


Hello everyone! I'm pretty new to the D world, and just started
playing around with it. To start off with the language, I was
going to write a little game (as I usually do). I wanted to use
pure D (no ncurses) and not have to import any libraries (no
anything else) for the project. So I set out to make it a CLI
game.

I've written myself a nice little library for formatting the
output and doing all that lovely stuff with the terminal -
however I'm having trouble with input. You see, I need
nonblocking (which I've set up) input that can read character by
character (so when the user presses r, it immediately takes it
in, not waiting for an enter) and I need to be able to see things
like arrow keys, shift keys, and control keys.

I've looked around extensively, but I have yet to find anything
on how to set up character by character input NOR have I found
anything on receiving those special characters in D. I know it's
quite possible in C, but again, half the point of this project is
being pure D.So how would I go about implementing this?

Thank you in advance!


More information about the Digitalmars-d-learn mailing list