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,


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
End If[/code]

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


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.