[Newbies] Opening a file twice

Matthew Fulmer tapplek at gmail.com
Fri Jul 6 00:00:16 UTC 2007


On Thu, Jul 05, 2007 at 04:47:15PM -0700, Matthew Fulmer wrote:
> > 2) When I had things really borked I did a  'Explore it' on 'FileStream
> > allInstances' and saw a few entries that had all the fields set to nil
> > except fileID, which was the same value as a valid stream on the file.  In
> > Windows or unix I can close a file if all I have is the file
> > descriptor(/handle).  How would I close the file if I've broken all the
> > references, apart from forcing a garbage collect?
> 
> FileStream allInstances do: [ :each | each close ]

you could also be selective about it:

- Type "FileStream allInstances"
- hit cmd-shift-I (this runs the "explore it" command)
- select the file you want to close
- type "self close" in the code panel of the explorer
- hit cmd-D ("do it")

but doing "Smalltalk garbageCollect" is fine too

-- 
Matthew Fulmer -- http://mtfulmer.wordpress.com/
Help improve Squeak Documentation: http://wiki.squeak.org/squeak/808


More information about the Beginners mailing list