Path: utzoo!attcan!utgpu!watmath!att!pacbell!ames!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!crdgw1!sungod!davidsen From: davidsen@sungod.crd.ge.com (William Davidsen) Newsgroups: comp.unix.wizards Subject: Re: Checking an fd for pending data (sans select(3)) Message-ID: <1456@crdgw1.crd.ge.com> Date: 2 Aug 89 18:26:57 GMT References: <11727@cgl.ucsf.EDU> <4001@cps3xx.UUCP> <14779@dartvax.Dartmouth.EDU> Sender: news@crdgw1.crd.ge.com Reply-To: davidsen@crdos1.UUCP (bill davidsen) Organization: General Electric Corp. R&D, Schenectady, NY Lines: 20 The name for the procedure which tells you if a key has been pressed is usually kbhit(), and what you need is fkbhit() I guess. In SysV you can set the read to timeout with an ioctl. The values to set are in the control structure. Here's a code fragment (you want to modify it). ioctl(0, TCGETA, &otermio); /* save old settings */ ntermio.c_iflag = 0; /* setup new settings */ ntermio.c_oflag = 0; ntermio.c_cflag = otermio.c_cflag; ntermio.c_lflag = 0; ntermio.c_line = otermio.c_line; ntermio.c_cc[VMIN] = 1; ntermio.c_cc[VTIME] = 0; ioctl(0, TCSETAW, &ntermio); /* and activate them */ Good luck. bill davidsen (davidsen@crdos1.crd.GE.COM) {uunet | philabs}!crdgw1!crdos1!davidsen "Stupidity, like virtue, is its own reward" -me