How can I save a whole dictionary into a text file?

Hi guys,

after finally having my files being read in (which takes about 100 seconds for now), I don’t want to do this all over again each time I start the app and debug my new code.

So I want to safe my important data that I have right now in arrays (that’s easy), some integer variables (again easy) and finally two dictionaries I’ve built up.

How can I save the dictionary in one easy go into a text file (or a file of any structure that can be read later on when I start my app again)? Or otherwise safe it key-value entry by entry? I’m a bit puzzled as to how I can achieve this.

Thanks in advance,

Andreas

Ok, I manage to save all the values of the dictionary with this little code:

[code] Dim myFile As FolderItem
Dim stream As TextOutputStream
Dim i As Integer

myFile = GetFolderItem(“E:\dActualJoined.txt”)
If myFile <> Nil then
stream = TextOutputStream.Create(myFile)
For i = 0 to 10
stream.WriteLine(dProfile.value(dProfile.Key(i)))
Next
stream.Close
End If[/code]

Still, how can I save the corresponding keys saved in the dictionary?

Andreas

Use XMLDictionary. There is a copy of it in the MacOSLib project.

If this is Mac only, you can also use my MacPListBrowser, also in MacOSLib.

You might also try using jsonitem.