BZ #1190: stream behaviour on encountering an EOF

Paul Eggert eggert@cs.ucla.edu
Thu Sep 13 21:00:00 GMT 2012


On 09/13/2012 01:30 PM, Rich Felker wrote:
> I'm having a hard time seeing how a tape at EOF could come to have
> more data available.

That's longstanding standard behavior for tape devices.  Multiple
files reside on the tape, in sequence.  You read one file until EOF.
Then you read some more data, to get the next file.  You do this
without closing and reopening the file; you just issue a bunch of
read() calls -- when read() returns 0 that means you got an EOF.  The
last file is followed by two EOF markers instead of one.  This
behavior is no more fragile than anything else having to do with tape
(admittedly not my favorite device to deal with).



More information about the Libc-alpha mailing list