Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 10,041 times

Related Categories

Loading Huge Files

Kimmy

l is set to 2k, 2*1024.  this is the buffer size, ie: how much to load in each go
strFile is the name of the file to open.

Dim l as long, sz as long
Dim FN As Integer
Dim strFile As String, c As String
FN = FreeFile
Open strFile For Binary Access Read As #FN
   l = 2 * 1024: c = Space$(l)    ' 2k Buffer Size,  2 * 1024
   sz = LOF(FN)
   
   If sz / l Then
       For d = 1 To sz / l
           Get #FN, , c
           MsgBox c
       Next
   End If

' load remainder of file, if filesize is not exactly divisable by l (2k)
   l = sz Mod l
   If l Then
       c = Space$(l)
       Get #FN, , c
       MsgBox c
   End If
Close #FN


The data loaded is returned in variable c. Do whatever you like with it..

Till the Roof comes off Till the Lights go out Till my Legs give out Can't shut my mouth I will not fall, my Wisdoms all.

Comments

  • Posted by James Crowley on 14 Mar 2002

    Sorry SenGoku. I asked mike to change the variable names such as (File$) to just (Dim File As String). However, it appears he's gone and changed some other bits that he shouldn't have :p

    I'll corre...

  • Out your arse

    Posted by Kimmy on 14 Mar 2002

    dont change my fucking code. it worked perfectly or post your own version

    strC = strSpace(FN) should be strC=Space$(l)

    in fact strC is wrong, because it ain`t declared as a String, which m...