原帖由 rojer521 于 2007-7-28 11:47 发表
do until (myfile.AtEndofStream)
tmp = myfile.readline
...
loop
学习了作者: james.zhong 时间: 2007-8-2 09:36
哈哈~~~学到点经验~~谢谢!!作者: v_v 时间: 2007-8-6 01:10
Call read_line(3)
Function read_line(rowcount)
Set fso=CreateObject("scripting.FileSystemObject")
Set myfile = fso.openTextFile("D:\temp\test.txt",1,false)
For i=0 to rowcount-1
read_line=myfile.ReadLine
msgbox read_line
Next
myfile.close
End Function
可以实现循环读取各行的值作者: binflying 时间: 2007-8-7 19:28
没看明白 还没到QTP 倒啊`~~作者: coletan 时间: 2007-8-21 10:07
有没什么办法是可以读到制定哪一行,比如说我开头的是IE.EXE,但是行数会不断的变化作者: yuandjing 时间: 2007-8-22 14:59
耶,这样就强壮了
Function read_line(pathway, rowcount)
Dim fso,myfile,i,flag
flag = 1
Set fso=CreateObject("scripting.FileSystemObject")
If fso.FileExists(pathway) then
Set myfile = fso.openTextFile(pathway,1,false)
Else
flag = 0
End If
For i=1 to rowcount-1
If Not myfile.AtEndOfLine Then
myfile.SkipLine
End If
Next
If flag = 1 then
If Not myfile.AtEndOfLine Then
read_line = myfile.ReadLine
Else
read_line = "文本越界"
End If
myfile.close
Else
read_line = "文件不存在"
End If
End Function