Saving settings/scores

BlitzMax Forums/BlitzMax Beginners Area/Saving settings/scores

Try this
Strict

Local hiscore:Int[10]

Print "==============="
Print "Unsorted"
For Local i:Int=0 To hiscore.length-1
	hiscore[i]=Rnd(0,10000)
	Print "hiscore["+i+"]="+hiscore[i]
Next

hiscore.sort  
Print "==============="
Print "Sorted"
For Local i:Int=0 To hiscore.length-1
	Print "hiscore["+i+"]="+hiscore[i]
Next

'write hi-score
Local out:TStream=WriteStream("c:\Hiscore.dat")

For Local i:Int=0 To hiscore.length-1
	WriteInt(Out,hiscore[i])
Next

CloseStream(Out)


'Read hi-score
Local In:TStream=ReadStream("c:\Hiscore.dat")

For Local i:Int=0 To hiscore.length-1
	hiscore[i]=ReadInt(In)
Next

CloseStream(In)

Print "==============="
Print "Read from File"
For Local i:Int=0 To hiscore.length-1
	Print "hiscore["+i+"]="+hiscore[i]
Next