|
试试这个看看 注意: myInFile是文件名 适应大小文件 (tmtony)
Function lineCount(myInFile As String) As Long
Dim lFileSize As Long, lChunk As Long
Dim bFile() As Byte
Dim lSize As Long
Dim strText As String
lSize = CLng(1024) * 10
ReDim bFile(lSize - 1) As Byte
Open myInFile For Binary As #1
lFileSize = LOF(1)
lChunk = 1
Do While (lSize * lChunk) < lFileSize
Get #1, , bFile
strText = StrConv(bFile, vbUnicode)
lineCount = lineCount + searchText(strText)
lChunk = lChunk + 1
<st1:place>Loop</st1:place>
ReDim bFile((lFileSize - (lSize * (lChunk - 1))) - 1) As Byte
Get #1, , bFile
strText = StrConv(bFile, vbUnicode)
lineCount = lineCount + searchText(strText)
Close #1
lineCount = lineCount + 1
End Function
|
|