Get single keystroke?

Jonathan M Davis jmdavisProg at gmx.com
Mon Mar 21 14:52:44 PDT 2011


> Lars Holowko:
> > what you want to do is OS dependent.
> 
> But the need to get a keystroke is simple and not so uncommon, so I think
> Phobos needs a function to do that that works on both Windows/Linux (and
> Mac too).

Assuming that it could be done cleanly, it would be a good function to add, 
but honestly, I dispute that it's a common need in this day and age. If all 
you need is something like "press any key to continue," you can easily do that 
with the current functions by having "press enter to continue," and if you 
need to do something other than that, odds are you need something more 
powerful like ncurses anyway. Not to mention, I don't think that interactive 
console apps are all that common these days. They definitely exist, but most 
console apps essentially run a single command for you and then quit. Most of 
the types of applications which would have have been interactive console apps 
in the past are now GUI apps.

So, while it certainly wouldn't hurt to add a function like this to Phobos 
(assuming that it could be done cleanly), I really don't think that it's a 
common need anymore.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list