Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Trouble reading binary file

PeterHhPeterHh Posts: 2Member
I'm a VB6 programmer, but VB6 can't read big binary files. I converted my VB6 code in VB.NET, but experience trouble when I want to read a binary file.

I use a type (structure) t_LASHeader

[color=Blue][code] Public Structure t_LASHeader
'Header 1.1
Public FileSig() As Char
Dim FileSource As Short
Dim reserved As Short
Dim GUID1 As Integer
Dim GUID2 As Short
Dim GUID3 As Short
Public GUID4() As Char
Dim VersionMajor As Byte
Dim VersionMinor As Byte
Public SystemIdentifier() As Char
Dim FileCreationDoY As Short
Dim FileCreationYear As Short
Dim HeaderSize As Short
Dim Offset2PointData As Integer
Dim NRVarLengthRecords As Integer
Dim PointDataFormatId As Byte
Dim PointDataRecordLength As Short
Dim NrPointRecords As Integer
Dim NrPointsbyReturn1 As Integer
Dim NrPointsbyReturn2 As Integer
Dim NrPointsbyReturn3 As Integer
Dim NrPointsbyReturn4 As Integer
Dim NrPointsbyReturn5 As Integer
End Structure[/code]
[/color]

I made a button to start reading

[color=Blue][code] Private Sub cmdStart_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdStart.Click

Dim LasHeader As t_LASHeader
Dim ff As Short

ff = FreeFile()
s="c: emp224102_000042.las"
FileOpen(ff, s, OpenMode.Binary, OpenAccess.Read)
FileGet(ff, LasHeader)
FileClose(ff)
End Sub[/code]
[/color]

I get an error when it reaches FileOpen (ArgumentOutOfRangeException was unhandled). I used the code from a thread on this forum, dated 2003, so it should work... What am I doing wrong?

The LAS-file is a file of about 3Gb. In VB6 I use a pointer, but it is limited to a long, while I need bigger...

Peter


Sign In or Register to comment.