kbhit() in a native app run from CYGWIN console does not work?

Daniel Colascione dancol@dancol.org
Fri Aug 3 23:48:00 GMT 2012

On 8/3/2012 3:33 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote:
> Hi All,
> I have a native Windows app that is run from bash (which is in turn run
> in a standard Cygwin terminal window, mintty).  The application's code uses
> kbhit() to check whether input is available from the user -- but it looks
> like kbhit() never indicates any input (when keys are getting pressed).
> The app works just fine if started directly from CMD.EXE.
> Is that the expected behavior?

mintty is not a real Windows console, so programs that try to access the console
directly (like your kbhit-using program) won't work. Try running your program
under the "conin" program, or run bash inside a console window.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20120803/2b7ea3ee/attachment.sig>

More information about the Cygwin mailing list