From: kris AT wren DOT rpms DOT ac DOT uk (Kris Thielemans) Subject: Re: how to do a timeout in getchar 12 Mar 1998 23:24:43 -0800 Message-ID: <199803121048.KAA13674.cygnus.gnu-win32@gluon.rpms.ac.uk> To: gnu-win32 AT cygnus DOT com Hi, I've always been using getch() from curses for this on Unix. Unfortunately, there is no curses library in cygwin. I know of the existence of pdcurses and ncurses, but tried neither of those yet. Can anyone advise me on the difference between the two ? Of course, using curses just for getch() seems a bit overkill, but select() is a bit complicated for me... Kris > From owner-gnu-win32 AT cygnus DOT com Thu Mar 12 09:00:27 1998 > From: cgf AT bbc DOT com (Christopher Faylor) > Subject: Re: how to do a timeout in getchar > X-Newsreader: trn 4.0-test62 (21 February 1998) > Date: Wed, 11 Mar 1998 15:36:15 GMT > To: gnu-win32 AT cygnus DOT com > > In article <00a801bd4c36$8f05aa20$299f23cb AT markread>, > Mark Read wrote: > >Hi Jacob. > > > >I've been looking for a way to set a flag if a key *isn't* present in the > >keybrd buffer, or set a flag *immediately* a SIGINT (eg. ctrl-c) occurs. > >However, I can't find a solution to either of these requirements. > > > >getchar(): Will suspend my loop until a character is received in the kbd > >buffer. I want my loop to continue executing if *nothing* is in the kbd > >buffer! > > > >_kbhit is ideal for this, but I can't see gnu-win32 supporting this. I > >searched my entire gnu dir tree, which covers *all* the include directories, > >and nothing found - no prototype. > > > >It was, however, found inside these files: > >- c:\gnu\tcl\cw3215.dll > >- c:\gnu\H-i386-cygwin32\bin\cygwin.dll > >- c:\gnu\H-i386-cygwin32\i386-cygwin32\linwinserve.a and libcygwin.a > > > >Isn't libcygwin.a automatically linked at compile time? I added _kbhit() to > >my source code and the compiler complained about "syntax error before > >_kbhit". > > If I do a 'nm libcygwin.a | grep kbhit' nothing shows up. kbhit is not > exported by cygwinb19.dll. > > However, you should be able to use select() to do what you want. select() > operates on console input correctly, AFAIK. > -- > http://www.bbc.com/ cgf AT bbc DOT com "Strange how unreal > VMS=>UNIX Solutions Boston Business Computing the real can be." > - > For help on using this list (especially unsubscribing), send a message to > "gnu-win32-request AT cygnus DOT com" with one line of text: "help". > - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".