First section saves all data in a Structureobject.
Next section just loads same data into another object based on the same structure. Now the first string reads well but all the "words" are messed up and when trying to show the words as str() it shows all kinda of numbers from -36726381 to +12378271 (approx

Now, am i not supposed to mix in writing a string in a file at first or is the problem somewhere else????
Code: Select all
Structure SDynamicGraphics
Name.s
ClipX.w[22]
ClipY.w[22]
ClipWidth.w[22]
ClipLength.w[22]
PosX.w[22]
PosY.w[22]
EndStructure
;Save section looks like this
;Where Newsprite is a tempobject containing the data to be saved
FilNr=OpenFile(#PB_Any, Filename+".dat")
WriteString (NewSprite\Name)
For n = 0 To 21
WriteWord (NewSprite\ClipX[n])
Next n
For n = 0 To 21
WriteWord (NewSprite\ClipY[n])
Next n
For n = 0 To 21
WriteWord (NewSprite\ClipWidth[n])
Next n
For n = 0 To 21
WriteWord (NewSprite\ClipLength[n])
Next n
For n = 0 To 21
WriteWord (NewSprite\PosX[n])
Next n
For n = 0 To 21
WriteWord (NewSprite\PosY[n])
Next n
CloseFile (FilNr)
; Now Loadsection looks like this and doesnt work (from the first Word-data)
FilNr=OpenFile(#PB_Any, "Data\"+DynGraphFileName+".dat")
DynGraphics\Name=ReadString ()
For n = 0 To 21
DynGraphics\ClipX[n]=ReadWord ()
Next n
For n = 0 To 21
DynGraphics\ClipY[n]=ReadWord ()
Next n
For n = 0 To 21
DynGraphics\ClipWidth[n]=ReadWord ()
Next n
For n = 0 To 21
DynGraphics\ClipLength[n]=ReadWord ()
Next n
For n = 0 To 21
DynGraphics\PosX[n]=ReadWord ()
Next n
For n = 0 To 21
DynGraphics\PosY[n]=ReadWord ()
Next n
CloseFile (FilNr)
Ive tested all data coming in and it really is the data that it says.
As it is "word-data" I cannot read it in a simple txt-viewer to see if the file is written correctly and only loaded badly or if it's problem with the savefunction.
Any suggestions? Any idea what Im even talking about here?