C Input Question?

Mark Roddy mroddy at enmasse.UUCP
Fri Mar 1 01:56:09 AEST 1985


[ 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)



More information about the Comp.lang.c mailing list