On Wed, 28 Feb 2001, Nicholas C. Murphy wrote:
Under what circumstances would one want to seek beyond
the end of a file?
I think one might want to do this so that they can then write beyond the
current EOF. It's conceivable that one would want to write structs A, B,
and C such that they are contiguous on disk, but that you wish to write
them in the chronological order of A, C, then B. I think you would seek
beyond the EOF to write C, possibly, then write B.
I think that, in general, the hole created by the seek-beyond-EOF is
filled in with 0s until it is written for real. Thus, if you
seeked-beyond the EOF, wrote, and then read some part of the hole, it
should return all 0.
well. this doesn't help too much. but maybe it does a little bit. I
can't think of too many concrete reasons as to why you would want to do
this, except if you had a funky file format where you wanted to write the
file footer before the file was finished writing.
-mike