[Newbies] Opening a file twice

Matthew Fulmer tapplek at gmail.com
Thu Jul 5 23:47:15 UTC 2007

On Fri, Jul 06, 2007 at 09:23:40AM +1000, johnps11 at bigpond.com wrote:
> Thanks Dave.
> I'd looked at #close, but already had the system in a pretty weird state
> so it didn't seem to help.
> #ensure: is the kind of thing I really needed - but never found.

It is a method on a block:

you can use World Menu -> open -> Method Finder to find methods

> Two more questions arise:
> 1) How do I get a password to edit the wiki?  The page  'Recipe: Reading a
> file' could use a note about this.

username: squeak
password: viewpoints

> 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 ]

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

More information about the Beginners mailing list