X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Date: Wed, 23 Jan 2002 13:00:35 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: ROLAND cc: djgpp AT delorie DOT com Subject: Re: kbhit() In-Reply-To: <20020123105549.98938.qmail@web9101.mail.yahoo.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Wed, 23 Jan 2002, ROLAND wrote: > --- Eli Zaretskii wrote: > > Something is wrong with the rest of your code: > > kbhit() _is_ the function > > you are looking for. It returns immediately, > > without waiting for a key > > to be pressed. > > This is what my code looks like: > > if(kbhit()==0){ > if(getkey()==3){ > interrupt(); > } That's backwards: if kbhit() returns zero, it means that no key was hit. So what this program does is _always_ call getkey() when no key was pressed, and getkey() waits for a keypress.