Read Number of lines in Large Text File VB6

后端 未结 3 1514
萌比男神i
萌比男神i 2021-01-15 01:16

I have text File of Size 230MB. I want to Count Number of Lines OF that File.

I tried \"Scripting.FileSystemOblect\" but it goes out Of

3条回答
  •  青春惊慌失措
    2021-01-15 02:07

    This takes about 6 seconds for me on a 480mb binary file with 1mil+ 0xD (vbcr)

    Dim buff() As Byte
    Dim hF As Integer
    Dim i As Long, n As Long
    
    hF = FreeFile(0)
    
    Open "c:\windows\Installer\2f91fd.msp" For Binary Access Read As #hF
    ReDim buff(LOF(hF) - 1)
    Get #hF, , buff()
    Close #hF
    
    For i = 0 To UBound(buff)
        If buff(i) = 13 Then n = n + 1
    Next
    
    MsgBox n
    

提交回复
热议问题