Imports System.IO
Module Module1
Sub Main()
Using fs As New FileStream("d:\data.bin", FileMode.Open,
FileAccess.Read,
FileShare.ReadWrite)
Using br As New BinaryReader(fs)
Dim i As Integer = 0
Dim arr() As Integer = {0}
While (br.BaseStream.Position <> br.BaseStream.Length)
ReDim Preserve arr(i)
arr(i) = br.ReadInt32()
i = i + 1
End While
For Each n As Integer In arr
Console.WriteLine(n)
Next
End Using
End Using
End Sub
End Module
' run:
'
' 0
' 3
' 5
' 87
' 12
' 982
' 99