www.digitalmars.com         C & C++   DMDScript  

D - Equivalent of _kbhit() in D?

reply "Glenn M. Lewis" <noSpam noSpam.com> writes:
What is the equivalent of _kbhit() in D for testing whether a key has been
pressed?
(I'm running on WinXP.)
Thanks!
								-- Glenn Lewis
Mar 11 2004
next sibling parent reply Brad Anderson <brad sankaty.dot.com> writes:
Glenn M. Lewis wrote:
 What is the equivalent of _kbhit() in D for testing whether a key has 
 been pressed?
 (I'm running on WinXP.)
 Thanks!
                                 -- Glenn Lewis

What library is _kbhit() in? You'd probably have to find the equivalent Win32 API call and wrap it in D. See: http://www.digitalmars.com/d/windows.html and to a lesser extent: http://www.digitalmars.com/d/htomodule.html BA
Mar 11 2004
parent Vathix <vathix dprogramming.com> writes:
Brad Anderson wrote:
 Glenn M. Lewis wrote:
 
 What is the equivalent of _kbhit() in D for testing whether a key has 
 been pressed?
 (I'm running on WinXP.)
 Thanks!
                                 -- Glenn Lewis

What library is _kbhit() in? You'd probably have to find the equivalent Win32 API call and wrap it in D. See: http://www.digitalmars.com/d/windows.html and to a lesser extent: http://www.digitalmars.com/d/htomodule.html BA

GetAsyncKeyState ? -- Christopher E. Miller
Mar 11 2004
prev sibling next sibling parent "Walter" <walter digitalmars.com> writes:
You can call any C function from D, including all that are in the C runtime
library, snn.lib:

extern (C) int _kbhit();

"Glenn M. Lewis" <noSpam noSpam.com> wrote in message
news:c2qec9$i6r$1 digitaldaemon.com...
 What is the equivalent of _kbhit() in D for testing whether a key has been

 (I'm running on WinXP.)
 Thanks!
 -- Glenn Lewis

Mar 11 2004
prev sibling parent StuartD <StuartD_member pathlink.com> writes:
For a console program try kbhit()    without the _

it's defined in stdio.d

S
In article <c2qec9$i6r$1 digitaldaemon.com>, Glenn M. Lewis says...
What is the equivalent of _kbhit() in D for testing whether a key has been
pressed?
(I'm running on WinXP.)
Thanks!
								-- Glenn Lewis

Mar 11 2004