Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/3/84; site enmasse.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!enmasse!mroddy From: mroddy@enmasse.UUCP (Mark Roddy) Newsgroups: net.lang.c Subject: Re: Re: C Input Question? Message-ID: <362@enmasse.UUCP> Date: Thu, 28-Feb-85 10:56:09 EST Article-I.D.: enmasse.362 Posted: Thu Feb 28 10:56:09 1985 Date-Received: Sat, 2-Mar-85 03:13:28 EST References: <1556@ritcv.UUCP> <155@cci-bdc.UUCP> Distribution: net Organization: Enmasse Computer Corp., Acton, Mass. Lines: 37 [ bug me not ] { use nodelay mode to solve reading from empty terminal input file } But if you don't have 4.2, V3(5): alarm(x); read(0,buf,1); alarm(0); /* and set up a signal routine for SIGALARM */ x is the number of seconds your read will time out in. There is a problem here, if you lose the cpu at alarm(x), you may get alarmed before read. You could lock yourself in before the alarm call, but that's rather rude. I was reading Creative Computing when I saw the most bogus C programming example. The author was comparing C to Basic- Basic: if A=1 and B=1 goto 104950393040 [:-> C: if (A==1 & B==1) foobar(); Which works, of course, but it was clear from the context that the author thought that '&' and logical AND were identical!!!! Boy is he in for a surprise. Don't they have editors at that mag? -- Mark Roddy Net working, Just reading the news. (harvard!talcott!panda!enmasse!mroddy)