ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Extracting variable sized strings from binary file (https://www.excelbanter.com/excel-programming/313676-extracting-variable-sized-strings-binary-file.html)

luis

Extracting variable sized strings from binary file
 
I need to extract strings from a binary file with the following format

INT-STRING-INT_STRING-INT-STRING-..........

where the integer is the length of the string.

I want to make a function that does what this failed attempt yearns...


Public Function svString(ByVal FileNo As Integer, Cursor As Integer) As
String
Dim sze As Integer
sze = 10
Get #FileNo, Cursor, sze ' Get string len
Dim svString As String * sze
Get #FileNo, Cursor + 4, svString ' Get string
End Function


The problem is declaring an array whith a variable (has to be constant)
can anybody provide tips ?

Luis Amezcua

Extracting variable sized strings from binary file
 
Bump ...

Any pointers would be really appreciated ...

luis wrote in message ...
I need to extract strings from a binary file with the following format

INT-STRING-INT_STRING-INT-STRING-..........

where the integer is the length of the string.

I want to make a function that does what this failed attempt yearns...


Public Function svString(ByVal FileNo As Integer, Cursor As Integer) As
String
Dim sze As Integer
sze = 10
Get #FileNo, Cursor, sze ' Get string len
Dim svString As String * sze
Get #FileNo, Cursor + 4, svString ' Get string
End Function


The problem is declaring an array whith a variable (has to be constant)
can anybody provide tips ?



All times are GMT +1. The time now is 05:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com