File I/O with an Array of Type <Resolved>
I'm trying to get a dynamic array of the following structure to be read from a file:
Public Structure factor
Dim weight(,) As Integer
<VBFixedString(10)> Dim tests() As String
<VBFixedString(10)> Dim modules(,) As String
<VBFixedString(150)> Dim desc As String
End Structure
It writes the array to file without problem if the array is of a pre-defined length, or if the array is only "0" long. However, when I try to read from the file, I get told:
"Cannot determine array type because it is Nothing"
The code I am using to read/write to file is as follows:
Public Sub factorIO(ByVal mode As String, ByRef list() As factor)
Dim length As Integer
Dim lengt As Long
If mode = "write" Then
FileOpen(2, fPath, OpenMode.Binary, OpenAccess.Write)
FilePut(2, list)
FileClose(2)
ElseIf mode = "read" And noTest = False Then
FileOpen(2, fPath, OpenMode.Binary, OpenAccess.Read)
FileGet(2, list)
FileClose(2)
End If
Does anyone know how to fix this?
And if its not possible to use arrays of structures with files... could someone explain how to read/write numerous versions of a structure into a file and read them out sequentially. I've hunted around for ages, and I cannot find any to do with writing structures to and from files, beyond just writing the single structure to file - which is of no use to me as you can't write 3 dimensional arrays to file.