I have a large four-dimensional array in my game and I need the most efficient way of saving/loading it possible. I am currently using four For..Next loops but I'm sure there's a faster way. Anyone?
Printable View
I have a large four-dimensional array in my game and I need the most efficient way of saving/loading it possible. I am currently using four For..Next loops but I'm sure there's a faster way. Anyone?
Sure ;)
have fun :)Code:Dim Array() as Whatever
Dim Size as Long
Dim FileNum as Integer
Sub Form_Load()
size = 100000
Redim array(size)
End Sub
Save(FileName as string)
Filenum=freefile
Open filename for binary as filenum
put filenum,,size
put filenum,,array
close filenum
end sub
Save(FileName as string)
Filenum=freefile
Open filename for binary as filenum
get filenum,,size
redim array(size)
get filenum,,array
close filenum
end sub
Saving it to a file? Well just do this:
You don't have to use loops, just stick the whole thing in like that.Code:Open strFileName For Binary As #1
Put #1, , ReallyBigArray
Close #1
I was faster :D
*D'oh*
Hehe ;)
What exactly are you using this four-dimensional array for?
You have 2 Save functions in your code. The 2nd one should be Open.:)Quote:
Originally posted by Fox
Sure ;)
have fun :)Code:Dim Array() as Whatever
Dim Size as Long
Dim FileNum as Integer
Sub Form_Load()
size = 100000
Redim array(size)
End Sub
Save(FileName as string)
Filenum=freefile
Open filename for binary as filenum
put filenum,,size
put filenum,,array
close filenum
end sub
Save(FileName as string)
Filenum=freefile
Open filename for binary as filenum
get filenum,,size
redim array(size)
get filenum,,array
close filenum
end sub