wumei2010@googlemail.com wrote:
>> It clears the
>> stream's "I've hit the end of the file" indicator, which
>
> Here "clears" doesn't mean EOF is removed, right?
The end-of-file indicator is part of the stream, not part
of the file. Again, I suggest you consider what changes are
made to a read-only file when you fseek() a stream that's
reading from it.
> i.e. it doesn't mean
> the stream could go beyond the actual end of the file.
Different file systems handle this differently, so C doesn't
try to tell them all how to behave on an off-the-end fseek().
On some systems the fseek() will fail. On others, the fseek()
may succeed but a subsequent attempt to read will fail. On
yet others, it is possible to fseek() past the end of the file
and start writing, producing a "sparse" file.
But none of these really has anything to do with "clearing
the end-of-file indicator." That indicator reports the state
of the stream, not of the file it's attached to.
> e.g. if the
> stream representing the original file is from memory location 0 to 10,
> when I fseek() from position 9, 3 locations, you will still get the
> EOF set for the stream right?9+3 is beyond the original stream
> representing the original file.
Here you've lost me: I don't understand how "memory locations"
enter into the picture.
--
Eric Sosman
esosman@acm-dot-org.invalid