Save and load types

Blitz3D Forums/Blitz3D Beginners Area/Save and load types

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hello i using Blitz3D for more then a year now. a first i was avoiding using types becaus they where hard to understand. Now i start understanding them and use them. For the most part everyting is working fine if i am using a type. But:

I am trying to save and load data from a type to a file.
Writing to a file works fine but when i want to load the file back it won't work.

here a exampple of source code i tested.
Type WorkMenuType
	Field ID
	Field Naam$
	Field LinkID
	Field XPos
	Field YPos
	Field Width
	Field Height
End Type



Dim WorkMenu.WorkMenuType (100)

For x = 0 To 100
	WorkMenu(x) = New WorkMenuType 
Next

If FileType ("MyTest.typ") = 1
	DeleteFile "MuTest.typ"
EndIf

outfile = WriteFile ("MyTest.typ")
For x = 0 To 100
	WriteString Outfile,Str(WorkMenu (x))
Next

CloseFile outfile

; All the above is working fine. when adding below an error comes up.

infile = ReadFile ("MyTest.typ")
For x = 0 To 100
	WorkMenu(x) = ReadString (Infile)
Next
CloseFile infile


Its generate a error "ILLIGAL TYPE CONVERSION"
If i leave the part of reading the file away. The program is running and saving the data fine.
why can i write to a file but not read the same way?