This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Non-blocking keyboard I/O in Cygwin?


Linux Dr. <usenet <at> haughtmail.com> writes:

> 
> I have a non-blocking keyboard I/O routine I've used for years under IRIX,
> Solaris and Red Hat linux.  It doesn't seem to work under cygwin, however.  The
> core of it is:
> 

Ok, I figured this out on my own... though it gave me a headache.  I wrote a
getch() which immediately returns a -1 if no input is waiting, or the ascii
value of the key if previously pressed.  It's non-blocking and no "enter" or
return key press is necessary.  Can be easily modified for echo or non echo,
blocking or non-blocking, and can count the number of keystrokes stored in the
input buffer without de-queueing them.  I'm happy to share... just send me an
email.  Compiles but doesn't back-port (run) correctly on linux or solaris. 
However, I have seperate versions for those machines, too.  This solution DOES
NOT REQUIRE curses/ncurses.  It works from shell scripts, as well.  Neall 





--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]