D
David Scemama
Hi,
I'm trying to read a database file written from a turbo Pascal program. I've
set a structure to map the records in the file, but
I have problem reading the file when I use VBFixedArray in my structure
instead of VBFixedString.
Here is the original code that works:
Structure CCat
Public code As Short
<VBFixedString(17)> Public name As String
<VBFixedString(30*10)> Public myList As String ' in fact, array of
10 strings of 30 chars
End Structure
Dim cat as CCat
Dim value as ValueType = cat
FileGet (1, value)
cat = CType(value, CCat)
The size of the array my change depending on the customer, so I cannot use a
fixed size structure. I've tried to replace it this way:
Structure CCat
Public code As Short
<VBFixedString(17)> Public name As String
<VBFixedArray(30)> Public myList() As String
End Structure
Dim cat as CCat
redim cat.myList(9) ' from what I know, this is supposed to
create an array of 10 strings of 30 chars each.
Dim value as ValueType = cat
FileGet (1, value)
cat = CType(value, CCat)
The fileGet function raises an IOException: Bad record Length.
Can someone tell me what I did wrong ? Also, is there a way to get the
record length I'm requesting before the FileGet ?
Thanks a lot for your help
David
I'm trying to read a database file written from a turbo Pascal program. I've
set a structure to map the records in the file, but
I have problem reading the file when I use VBFixedArray in my structure
instead of VBFixedString.
Here is the original code that works:
Structure CCat
Public code As Short
<VBFixedString(17)> Public name As String
<VBFixedString(30*10)> Public myList As String ' in fact, array of
10 strings of 30 chars
End Structure
Dim cat as CCat
Dim value as ValueType = cat
FileGet (1, value)
cat = CType(value, CCat)
The size of the array my change depending on the customer, so I cannot use a
fixed size structure. I've tried to replace it this way:
Structure CCat
Public code As Short
<VBFixedString(17)> Public name As String
<VBFixedArray(30)> Public myList() As String
End Structure
Dim cat as CCat
redim cat.myList(9) ' from what I know, this is supposed to
create an array of 10 strings of 30 chars each.
Dim value as ValueType = cat
FileGet (1, value)
cat = CType(value, CCat)
The fileGet function raises an IOException: Bad record Length.
Can someone tell me what I did wrong ? Also, is there a way to get the
record length I'm requesting before the FileGet ?
Thanks a lot for your help
David