Path: utzoo!utgpu!watserv1!watmath!att!pacbell!pacbell.com!ucsd!swrinde!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!cernvax!chx400!ethz!stp From: stp@ethz.UUCP (Stephan Paschedag) Newsgroups: comp.os.os9 Subject: Re: ttyfly() for os9? (try#2) Message-ID: <5787@ethz.UUCP> Date: 30 Aug 90 18:54:29 GMT References: <1990Aug30.152825.21217@cs.utk.edu> Reply-To: stp@bernina.UUCP (Stephan Paschedag) Organization: ETH Zuerich, Switzerland Lines: 28 In article <1990Aug30.152825.21217@cs.utk.edu> jonesjp@ornl.gov (JONES J P) writes: > >For simple interactive programs, I usually like to write a function >(char ttyfly() -- get one on the fly) which returns a character from >the keyboard if one is available, and 0 otherwise (non-blocking). Here it is : char ttyfly() { char ch; if (_gs_rdy(0) < 0) return(0); read(0,&ch,1); /* or ch=getchar() if stdin is in unbuffered mode */ return(ch); } ============================================================================== OS/2 & PS/2 : half an operating system for half a computer Stephan Paschedag stp@ethz.UUCP MPL AG, Zelgweg 12, CH-5405 Baden-Daettwil ..!mcvax!cernvax!chx400!ethz!stp ______________________________________________________________________________