Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site turtlevax.UUCP Path: utzoo!watmath!clyde!burl!hou3c!hocda!houxm!hogpc!houti!ariel!vax135!floyd!harpo!decvax!decwrl!flairvax!turtlevax!ken From: ken@turtlevax.UUCP Newsgroups: net.unix-wizards Subject: Re: getc() != EOF Message-ID: <402@turtlevax.UUCP> Date: Tue, 29-May-84 02:30:42 EDT Article-I.D.: turtleva.402 Posted: Tue May 29 02:30:42 1984 Date-Received: Fri, 1-Jun-84 21:59:23 EDT References: <30@utastro.UUCP> Organization: CADLINC, Palo Alto, CA Lines: 19 Beware that an alternative test for end-of-file doesn't seem to work on 4.2bsd like it did on 4.1 and before. I am referring to feof(): 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. TO run correctly on 4.2, one needs to do: while ((i = getchar()) != EOF) putchar(i); or for (i = getchar(); !feof(stdin); i = getchar()) putchar(i); -- Ken Turkowski @ CADLINC, Palo Alto, CA UUCP: {amd70,decwrl,flairvax}!turtlevax!ken