0
當我將600KB文本文件(HTML代碼)讀入字符串變量時,它截斷了大約一半的內容。這裏是我有的代碼...我哪裏錯了?VB6字符串變量截斷從文件中讀取的數據
Dim fso As New FileSystemObject
Dim f As File
Dim fsoStream As TextStream
Dim strLine As String
Set f = fso.GetFile("C:\Users\Neanderthal\Desktop\MyProj\GMATClubLog.txt")
Set fsoStream = f.OpenAsTextStream(ForReading)
' Read the file line by line, printing the results to the Form
Do While Not fsoStream.AtEndOfStream
strLine = fsoStream.ReadLine
Debug.Print strLine
Loop
Len(strLine)
fsoStream.Close
Set fsoStream = Nothing
Set f = Nothing
Set fso = Nothing
基本上我爲什麼要閱讀文本文件的全部內容,是因爲我想提取重複一套基於搜索條件的數據。這是重複碼
<td class="topicsName" style="width:100%">
<a class="newestPostIcon" href="http:someURL.com"></a>
<a title="some text" href="http://I want to extract this link.html" ></a>
</td>
您正在將每行讀入字符串變量。你是說每一行都被截斷了,或者只是通過文件的一半 – Rob 2014-11-23 10:32:08
它停止在文件中的特定字符嗎?它總是停止相同的位置? – Hrqls 2014-11-24 13:25:39