Option Strict and reading bytes from File

  • Thread starter Thread starter Kejpa
  • Start date Start date
K

Kejpa

Hi,
I want to read a fixed number of bytes from a file and when I turned on the
Option Strict I get an error I just can't fix.

The code:
Dim baInfo(99) As Byte
FileGet(iFilNr, baInfo, 5)

The Error:
Option Strict On disallows narrowing from type 'System.Array' to type
'1-dimensional array of Byte' in copying the value of 'ByRef' parameter
'Value' back to the matching argument.

Anyone any ideas?
/Kejpa
 
Kejpa said:
Dim baInfo(99) As Byte
FileGet(iFilNr, baInfo, 5)

The Error:
Option Strict On disallows narrowing from type 'System.Array' to type
'1-dimensional array of Byte' in copying the value of 'ByRef' parameter
'Value' back to the matching argument.

Untested:

\\\
FileGet(19, DirectCast(baInfo, Array), 5)
///
 
It worked, thanks a lot!

Do you have anything like it up the sleeve for reading structs?
I have the same problem there...

TIA
/Kejpa
 
Back
Top