delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/28/12:10:38.1

From: mapson AT mapson DOT com (Mapson)
Newsgroups: comp.os.msdos.djgpp
Subject: Keyboard access
Date: Wed, 28 Oct 1998 15:25:55 GMT
Organization: Yale University
Lines: 26
Message-ID: <36372e72.158861338@news.cis.yale.edu>
NNTP-Posting-Host: logan.eng.yale.edu
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm trying to implement some user-definable keyboard traps in a
program I'm writing, and am running in to problems with the keyboard
buffer. Basically, the user is inputs much more often on the keyboard
that I will need to access- the problem: when I am interested, I have
all the old characters in the buffer to empty out before I get to the
one of interest (the last). So far, I've simply done a

 while (kbhit())  tempc=getch();
 
and then used tempc once it has exited- which is usually OK, albeit
clunky. But since the keyboard buffer is not recirculating, sometimes
the user will enter too many keystrokes ahead of time and fill the
buffer, losing the char I am looking for. And emptying the buffer at
other times in the program is not practical, since the programs are
constructed by a general purpose "translator", so I can't know in
advance when a good time would be. Perhaps a timer routine (simulating
a sort of multi-tasking) would be the right thing- any tips on that? I
guess I'd need to write an ISR for that- yikes. 

But before I need to go to that level: is there a high-level way in
DJGPP to manipulate, directly access, or even temporarily disable the
keyboard buffer? If I could make it "recirculating", that would at
least be a sure (if clunky) solution.

Please post here- no e-mail. Thanks!

- Raw text -


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