读书人

有关文件的逐行存储,该怎么解决

发布时间: 2012-01-31 21:28:41 作者: rapoo

有关文件的逐行存储
我现在要读一个文件,用一个数组存储文件的每一行,即a(0)存第一行,a(1)存第二行...怎么操作?

[解决办法]
Dim fsoTxt As New FileSystemObject, tsTxt As TextStream
Dim i As Integer
Dim J As Integer

Set tsTxt = fsoTxt.OpenTextFile(AppfileName, ForReading)
tsTxt.ReadAll
J = tsTxt.Line
tsTxt.Close

Set tsTxt = fsoTxt.OpenTextFile(AppfileName, ForReading)
For i = 0 To J - 1
a(i) = tsTxt.ReadLine
Next

tsTxt.Close

读书人网 >VB

热点推荐