View Single Post
  #1 (permalink)  
Old 01-07-2009, 10:13 AM
mad_schatz mad_schatz is offline
VB.NET Forum Newbie
.NET Framework: .NET 3.0 (VS 2005/2008)
 
Join Date: Jan 2009
Age: 35
Posts: 13
Reputation: 17
mad_schatz is on a distinguished programming path ahead
Default Access Faster in Binary reading Single Data Types

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 :

Code:
        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
Reply With Quote