mad_schatz
Member
- Joined
- Jan 1, 2009
- Messages
- 15
- Programming Experience
- 1-3
Hi Gents,
I'm new in VB.Net and I'm trying to learn it.
I've a binary file which has 300.000+ single floating point numbers which I'm reading with the following code :
Unfortunately this reading process takes long time. About 4 mins.
My question is, Is there any other way to read single data types from a binary file more faster ?
Thanks for all
I'm new in VB.Net and I'm trying to learn it.
I've a binary file which has 300.000+ single floating point numbers which I'm reading with the following code :
VB.NET:
Dim ReadStream As FileStream
Dim llFileLen As Long
Dim liArrayLen As Integer
Dim lcFileName As String
liArrayLen = 0
lcFileName = Application.StartupPath & "\World_new.dat"
Me.TextBox1.Text = Now
ReadStream = New FileStream(lcFileName, FileMode.Open)
Dim readBinary As New BinaryReader(ReadStream)
llFileLen = ReadStream.Length
Do While ReadStream.Position < llFileLen
ReDim Preserve laCoords(liArrayLen)
laCoords(liArrayLen) = readBinary.ReadSingle()
liArrayLen = liArrayLen + 1
Loop
Me.TextBox2.Text = Now
readBinary = Nothing
ReadStream = Nothing
Unfortunately this reading process takes long time. About 4 mins.
My question is, Is there any other way to read single data types from a binary file more faster ?
Thanks for all