On Wed, 26 Sep 2012 13:06:03 -0500, Adam D. Ruppe
<destructiona...@gmail.com> wrote:
On Wednesday, 26 September 2012 at 17:51:03 UTC, Thomas Koch wrote:
How can I read single characters?
The way I'd do it is with the C call fgetc(stdin). You can do it in D
the same way if you import core.stdc.stdio;
But, if you are on Linux, it isn't going to be that simple. The Linux
terminal/operating system will buffer input, not sending any data to you
until the user presses enter.
You'll probably want to use a library like ncurses on linux... you can
do without too, turning on raw mode to the terminal I think, but I don't
remember how to do it right now. Are you on Linux or Windows?
(I'm pretty sure it just works on windows but it's been a while since
I've done an app like this.)
ncurses will do it with getch().
pdpurses should have the same function.
You will most likely still have to ncurses setup and teardown though.
shrug.