getc() != EOF

Guido van Rossum guido at mcvax.UUCP
Fri Jun 1 14:06:50 AEST 1984


>	while (!feof(stdin)) putchar(getchar());
>
>does not work.  It seems that the EOF indicator does not come on until
>the EOF marker has been read. Previous versions of the standard I/O
>library set the EOF flag if the last character has been read and the
>next one will be and EOF.

How *could* this ever have worked under UNIX???  Remember that the input
can be a pipe.  You only know there's no more data when a READ system
call returns <= 0.

--
	Guido van Rossum, "Stamp Out BASIC" Committee, CWI, Amsterdam
	guido @ mcvax



More information about the Comp.unix.wizards mailing list