Hey man - check out the Binary reader it is much faster
Regards,
Terry
'''''THE CODE
Option Strict On
Option Explicit On
Imports System.IO
Imports System.String
Imports System.Windows.Forms
Public Function Read_Binary_Data(ByRef sXfile As String) As Int32
Dim BRead As BinaryReader
Dim BWrite As BinaryWriter
Dim FStream As FileStream
Dim bArray() As Byte
'''''Dim sXfile As String
sXfile= "C:\MyBinaryfile.bin" 'Your file name goes here
Try
FStream = New FileStream(sXfile, FileMode.Open, FileAccess.Read, FileShare.Read)
'BWrite = New BinaryWriter(FStream)
BRead = New BinaryReader(FStream)
Catch Errz As Exception
Return (-1) 'FAILURE!
Exit Function
End Try
Redim bArray(100) 'Dim the byte array to read 100 bytes - element 0 to 99
'Seek past the first 50 bytes in file before I attempt to read array
BRead.BaseStream.Seek(50, SeekOrigin.Begin)
bArray = bcRead.ReadBytes(bArray.Length) 'The bytes
BRead.Close()
BWrite.Close()
FStream.Close()
Return (0) 'SUCCESS!
End Function