delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/01/10/22:06:33

From: Damian Yerrick <Bullcr_pd_yerrick AT hotmail DOT comRemoveBullcr_p>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Problem with kbhit()
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <qp4q5tom0rf69rh7kgvjj0b1qkm6pekl51@4ax.com>
References: <3A5AE4E7 DOT 85120936 AT student DOT uni-ulm DOT de> <3A5AEFF6 DOT C2432EBE AT student DOT uni-ulm DOT de>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 26
X-Trace: /K+neVnRk3KyMrej2wkS/Ou7Avi7Sw+aurX0PsIjZVYeIPK2TrsjFveo76tMZgNgFng5tt4LRL7u!MDjdE9OUf4X0qsJuUht18KIK+NZhEFdlLjqPSCIp+UNCTyc+flT0lny+RXswlvZYesCtUdzcTwAC!7fltDg==
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Thu, 11 Jan 2001 02:49:43 GMT
Distribution: world
Date: Thu, 11 Jan 2001 02:49:43 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Tue, 09 Jan 2001 12:03:18 +0100, Karsten Schmidt
<Karsten DOT Schmidt AT student DOT uni-ulm DOT de> wrote:

>I guess I found a solution: I have to poll the character with getch()
>
>> int main (void)
>> {  while(!kbhit())    // Wait until key pressed
>>    {  printf(".");
>>       delay(1000); }
>
>     getch()             <-------- read keyboard

This may screw things up with respect to extended keys (Fkeys,
arrows).  An extended key will return 0 on the first read then a
scancode on the second read.

if(getch() == 0)
  getch();

-- 
<O
( \   GNOME vs. KDE: the game!
 X    http://pineight.8m.com/nes.htm

This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses.  http://www.mcafee.com/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019