VB6: Slow Binary Write?

Posted by Tom the Junglist on Stack Overflow See other posts from Stack Overflow or by Tom the Junglist
Published on 2010-04-26T22:13:25Z Indexed on 2010/04/26 22:23 UTC
Read the original article Hit count: 172

Filed under:
|
|
|

Wondering why a particular binary write operation in VB is so slow. The function reads a Byte array from memory and dumps it into a file like this:

Open Destination For Binary Access Write As #1

Dim startP, endP As Long
startP = BinaryStart
endP = UBound(ReadBuf) - 1
Dim i as Integer

For i = startP To endP

    DoEvents
    Put #1, (i - BinaryStart) + 1, ReadBuf(i)

Next

Close #1

For two megabytes on a slower system, this can take up to a minute. Can anyone tell me why this is so slow?

© Stack Overflow or respective owner

Related posts about vb6

Related posts about io