Hi,
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.
Newbie query - reading a data file
- grayghost4
- Posts: 187
- Joined: Wednesday 5th December 2018 5:00am
- Location: Marengo, Illinois usa
Re: Newbie query - reading a data file
I am not an expert at this but I found this ... it might help
- Attachments
-
- MyStruct-DB-0.0.tar.gz
- (8.26 KiB) Downloaded 283 times
Re: Newbie query - reading a data file
maybe this is a more "gambas-like" approach
https://gambas-buch.de/dwen/doku.php?id ... .9.4:start
or if you hold on struct
https://gambas-buch.de/dwen/doku.php?id ... .2.2:start
https://gambas-buch.de/dwen/doku.php?id ... .9.4:start
or if you hold on struct
https://gambas-buch.de/dwen/doku.php?id ... .2.2:start
Re: Newbie query - reading a data file
Hello, carlhood! You need to understand that using the string via the STRUCT feature with Gambas didn't help due to the common difference between VBs blocks. Also, I believe you got the different-sized blocks, which is the main issue. I would move the directory to another place and proceed with the restructuring process in your situation. After the process, you will need to check for the empty spaces on your disk, so you can use some recovery services like raid data recovery site.
Last edited by SheilaNoe on Thursday 14th April 2022 1:03pm, edited 1 time in total.
- Quincunxian
- Posts: 175
- Joined: Sunday 25th June 2017 12:14am
- Location: Western Australia
Re: Newbie query - reading a data file
Is this more like reading binary data?
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:
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:
Public Sub ReadVBData
Dim BFile As File
Dim NameAry As New String[]
Dim IntAry As New Integer[]
Dim TmpStr As String
Dim TmpInt As Integer
BFile = Open {file path} For Read
While Not Eof(BFile)
TmpStr = Read #BFile As String
TmpInt = Read #BFile As Integer
NameAry.Add(TmpStr)
IntAry.Add(TmpInt)
Wend
Close #BFile
End
Cheers - Quin.
I code therefore I am
I code therefore I am