Message-ID: <3A5AE4E7.85120936@student.uni-ulm.de> Date: Tue, 09 Jan 2001 11:16:07 +0100 From: Karsten Schmidt Organization: =?iso-8859-1?Q?Universit=E4t?= Ulm X-Mailer: Mozilla 4.75 [de] (Win98; U) X-Accept-Language: de MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Problem with kbhit() Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: pcks.e-technik.uni-ulm.de X-Trace: 9 Jan 2001 11:15:52 +0100, pcks.e-technik.uni-ulm.de Lines: 36 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi! I'm trying to detect when the user hits the keyboard. Unfortunately the kbhit() function is always true after the first key has been hit. Therefore I'm not able to detect any further hits. I've tracked down my problem to the following program: #include #include #include #include int main (void) { while(!kbhit()) // Wait until key pressed { printf("."); delay(1000); } printf("\n"); while (kbhit()) // Wait until key released { printf("+"); delay(1000);} exit(0); } As you coud see the program should exit after a key is pressed and released. But the programm is still running in the second loop. Perhaps someone could help me with this problem. Thanks in advance. -- Karsten