Newbie query - reading a data file
Posted
#1
(In Topic #540)
Trainee
I have a couple of data files that were created under VB6 with blocks of records of the same size and accessed using VBs random-access method. I know the structure and size of each record, but it seems I can't specify the size of a string using STRUCT in Gambas. , but stumped with Gambas Would welcome any thoughts how I might approach this problem.
Thanks.
Posted
Enthusiast

Posted
Enthusiast

https://gambas-buch.de…7.4:k7.4.9:k7.4.9.4:start
or if you hold on struct
k7:k7.2:k7.2.2:start [GAMBAS BOOK 3.19.5]
Posted
Expert

If you know the field types of each record then it should be possible to READ the file under Gambas.
You may need to do some trial and error to get the field types right but should not be too hard. See: Binary Data Representation
(very) rough example of reading multiple binary records comprised of a string and an integer Id fields:
Code (gambas)
- NameAry.Add(TmpStr)
- IntAry.Add(TmpInt)
- Close #BFile
Cheers - Quin.
I code therefore I am
I code therefore I am
1 guest and 0 members have just viewed this.



