On 14.10.2011 4:49, Nick Sabalausky wrote:
<snip>
That would be neat.
One thing I'd been thinking of adding to mine was an alternate function that
just waited for a single keystroke (rather than a line of text + Enter). I
think I once had it working on Tango, IIRC, but then I switched to D2/Phobos
and couldn't figure out how to use Phobos to wait for a single keystroke w/o
then waiting for Enter.
I used the following trick on Linux, and I think it should work on any
posix: call select on stdin i.e. fd_set with one descriptor for reading
- 0 and timeout of 0. This way you'd get something close to a test for
keypress.
However that will check if there is a data in stream, so it's quite
possible to hit any number of "press any key" in advance, so some
flushing of input in the "wait till keypress" function is needed.
--
Dmitry Olshansky