Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site faron.UUCP Path: utzoo!linus!faron!meister From: meister@faron.UUCP (Philip W. Servita) Newsgroups: net.lang.c Subject: Re: C Input Question? Message-ID: <247@faron.UUCP> Date: Mon, 4-Mar-85 11:26:31 EST Article-I.D.: faron.247 Posted: Mon Mar 4 11:26:31 1985 Date-Received: Sun, 17-Mar-85 19:13:10 EST References: <1556@ritcv.UUCP> <155@cci-bdc.UUCP> Reply-To: meister@faron.UUCP (Philip W. Servita) Distribution: net Organization: The MITRE Coporation, Bedford, MA Lines: 45 >> I am working an a very simple game using graphics text with a >> GiGi terminal. I am having a big problem with the input. When >> I get to a read, or any input statment, in C, everything stops >> and waits for the input. >> >[text cut for brevity. Scott wants non-blocking I/O, that is "read if >data, but don't wait for data.] >> >> Is there an easy way to do this in C. >> I am doing this on a VAX running 4.2 if that makes a difference. >> >> scott hossler >> rochester!ritcv!sah9577 i did this once i a game program also. try the following: #include ... char inkey() { long charwaiting; char getchar(); ioctl(0,FIONREAD,&charwaiting); if(charwaiting) return(getchar()); return((char) 0); } returns the next character on the stdin stream if there is one, 0 otherwise. this will only work in cbreak or raw mode. look up tty(4) for details. -the venn buddhist -- --------------------------------------------------------------------- is anything really trash before you throw it away? ---------------------------------------------------------------------