Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!brutus.cs.uiuc.edu!samsung!cs.utexas.edu!hellgate.utah.edu!helios.ee.lbl.gov!pasteur!buddy.Berkeley.EDU!c60b-hk From: c60b-hk@buddy.Berkeley.EDU (Geoffrey Broadwell) Newsgroups: comp.sys.ibm.pc.programmer Subject: Slow kbhit() fix Summary: Use Interrupt 0x16 Keywords: kbhit() Message-ID: <22242@pasteur.Berkeley.EDU> Date: 19 Feb 90 04:43:57 GMT References: <29@demott.COM> Sender: news@pasteur.Berkeley.EDU Reply-To: c60b-hk@buddy.Berkeley.EDU.UUCP (Geoffrey Broadwell) Distribution: usa Organization: University of California, Berkeley Lines: 19 I just caught an article referring to the fact that kbhit() is annoyingly slow. I have noticed this myself, and came up with the following function that responds quite a bit faster (I'm sure someone will one-up its speed, but what the hell -- it's simple! :-) ). char keypress(void) { _AH=0x01; geninterrupt(0x16); return(~_FLAGS&0x40); } I wrote it using TurboC 2.0, so if your compiler is different, the syntax is probably somewhat different, though it should be easily translatable. Good luck. BTW, I would be interested in being one-upped, if anyone is willing. :-) -'f (Geoffrey Broadwell)