Bug or feature in StandardFileStream

David T. Lewis lewis at mail.msen.com
Sun Feb 12 14:19:15 UTC 2006


On Sun, Feb 12, 2006 at 12:02:21PM +0100, Martin Kuball wrote:
> 
> The following behaviour seems odd to me:
> 
> file := StandardFileStream readOnlyFileNamed: 'test'.
> file skip: self size.
> file atEnd.  (-> true, OK)
> 
> file skip: 1.
> file atEnd (-> false ???)
> 
> My VM is rather old (> 1 year), so maybe someone should test this with 
> a more recent one.

It's a feature. It just means that you can set the file position beyond
end of file, at which point it is no longer "atEnd". You can use
#setToEnd to position the file pointer to the actual end of file.

If it did not work this way, you would have no way to (for example)
write a single byte at position 1000 without first having written
something to the preceding 999 positions. You probably don't want
to do this very often, but at least it's possible.

It works the same on Windows and Unix, so I expect that the behavior
is consistent across all platforms.

Dave





More information about the Squeak-dev mailing list