From: dbe AT wgn DOT net ("$Bill Luebkert") Subject: Re: GNUWIN32 Question 12 Jun 1997 04:10:16 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <339F4B8F.5AF.cygnus.gnu-win32@wgn.net> References: <01BC764E DOT 5C314230 AT gater DOT krystalbank DOT msk DOT ru> Reply-To: dbe AT wgn DOT net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01Gold (Win95; I) Original-To: Sergey Okhapkin Original-CC: "gnu-win32 AT cygnus DOT com" , "'Robert'" Original-Sender: owner-gnu-win32 AT cygnus DOT com Sergey Okhapkin wrote: > > Robert wrote: > > <> > > I love your product, I just need one thing. A kbhit() function. The Don't want to step on any toes here, but there are a couple of syntactic errors in this code fragment (marked below). Haven't tried the code, so I can't say anything about the logic (which looks ok). :) > #include > #include > > int kbhit() > { > FD_SET rfds; Should be lowercase: fd_set rfds; > struct timeval tv; > > FD_ZERO(&rfds); > FD_SET(0, &rfds); > tv.tv_sec = 0; > tv.tv_usec = 0; > select(1, &rfds, 0, 0, &tv); Could check for error return here, but not too likely. > return(FD_ISSET(0, &rfds); Leave off the first paren: return FD_ISSET(0, &rfds); > } Just in case robert isn't an experienced programmer. :) -- ,-/- __ _ _ $Bill Luebkert (_/ / ) // // DBE Collectibles / ) /--< o // // http://www.wgn.net/~dbe/ -/-' /___/_<_