How can this be broken ?!!?

Chris Sylvain don at umd5
Thu Oct 16 05:01:10 AEST 1986


This worked with Ultrix 1.2:
	while( fputc( fgetc(fd), fe) != EOF );
But is broken with 4.3BSD [!!] on the same microVAX ...
The char M-^? is written endlessly to the "fe" file.
M-^? means 8th bit set, lower 7 bits == ^? ...
<stdio.h> says: #define EOF (-1)
fputc and fgetc are int functions, and fgetc is supposed to return EOF
at the end of the file. I fixed my code by using feof(fd) ...
Am I right by saying the above code fragment by rights should still work ?

-- 
--==---==---==--
.. Long time the manxome foe he sought -- ..

ARPA: don at umd5.UMD.EDU     BITNET: don%umd5 at umd2
UUCP: ..!{ seismo!umcp-cs, ihnp4!rlgvax }!cvl!umd5!don

** WARNING: don at mimsy.UMD.EDU is a different person **
** (umcp-cs and mimsy.umd.edu are the same machine) **
**   -->   Please double-check the address   <--    **



More information about the Comp.lang.c mailing list