Storing arrays and types into a file

Blitz3D Forums/Blitz3D Programming/Storing arrays and types into a file

MadMunky(Posted 2004) [#1]
Hi there,

Does anyone know how to easily read/write arrays and types into a file. For example: WriteArray(f, arrayName), or typeName=ReadType(f)

Thanks in advance!


N(Posted 2004) [#2]
No. Write your own procedures for them.

Dim Array(50)

Function WriteArray(Stream,Size)
     For i = 0 To Size
          WriteInt Stream,Array(i)
     Next
End Functon


It's simple. As for types, you'd have to write your own procedure to read and write its fields. Unless you fancy string parsing: Str(TypeObject) (or was it String(..)?)


MadMunky(Posted 2004) [#3]
String parsing? Is that possible? Well, one way to find it out.

The writeArray is indeed very simple (should have thought about it myself :/ ). Thanks for waking me up.