Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!asuvax!noao-gemini!noao!amethyst!raw From: raw@math.arizona.edu (Rich Walters) Newsgroups: comp.lang.c Subject: Re: Keypressed exists? Message-ID: <1415@amethyst.math.arizona.edu> Date: 15 Feb 90 03:16:24 GMT References: <1990Feb10.190053.15413@alzabo.uucp> Sender: news@amethyst.math.arizona.edu Distribution: comp Organization: Dept. of Math., Univ. of Arizona, Tucson AZ 85721 Lines: 27 In article <1990Feb10.190053.15413@alzabo.uucp> tris@alzabo.uucp (Tris Orendorff) writes: >ron@clarity.Princeton.EDU (Ronald Beekelaar) writes: > >>Hi > >> I have a very simple question, although I can't find the answer myself. How >>do you quietly test whether any key was pressed on the keyboard? I want to >>write a function that waits 10 seconds, if any key had been pressed, but >>doesn't wait at all, if none was pressed. > >In Microsoft C V5.1 you can use the functions kbhit () and getch (). >See section 4.8.3 in the run-time library reference book. > > Unix BSD has something similar but you must use cbreak mode which entails a lot of other overhead. Like reading the termcap/terminfo file and doing all kinds of setup yourself. Most of what you need is included, but I don't remember where off the top of my head. Richard Walter ------------------------------------------------------------------------------- Keep crunching those numbers -------------------------------------------------------------------------------