fread and read from a terminal

utzoo!decvax!ucbvax!dcrocker at udel utzoo!decvax!ucbvax!dcrocker at udel
Wed Jul 22 06:39:14 AEST 1981


From:      Dave Crocker <dcrocker at udel>
You miss the point.

1.  Stdio's _filbuf() thinks that end-of-file has been reached,
because it sets the bit.  (I.e., feof(stdin) returns true.)

2.  I said that the control-D was typed at the beginning of the
line, thus forcing a zero-length read().

The problem is that fread() is not correctly dealing with the fact
that its input is buffered and, hence, it must defer reporting some
events, such as end-of-file.

Dave





More information about the Comp.unix.wizards mailing list