Reading Dictionary from File

Cameron Bowes cbowes at mnsinc.com
Sat Dec 5 15:26:48 UTC 1998


Hi Folks!

I've got a dictionary of timing data that I keep in a text file. I finally
decided to work up a couple of methods to basically dump the thing out and
read it back in.

To dump it, I open a FileStream and use storeOn: to stream it out to the
file. So I have a file with the Dictionary all neatly arranged to be read
back in. Which I can cut and paste into a workspace with a variable
assignment to recreate the Dictionary.

I'd like to read it back in directly from the file though, and this is where
I'm stumped (yes, I'm a relative newbie). I open the FileStream, and then
use contentsOfEntireFile to grab the data, which passes me back a string.
Assigning that to a variable gives me just that, a string. What I'd like to
do is pass the thing to the variable so that the Dictionary definition gets
recreated.

I think I must be missing something really simple here! TIA for any
suggestions!

Regards,

Cam Bowes
cbowes at mnsinc.com





More information about the Squeak-dev mailing list