标题: [求助]VBScript中怎么判断文件末尾呀,老师快来 [打印本页] 作者: binbin199 时间: 2006-12-12 17:46 标题: [求助]VBScript中怎么判断文件末尾呀,老师快来 Sub ReadExternalData
Dim fso, ts, s
Const ForReading = 1
Dim Num1, Num2, Ret
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile("c:\data.csv", ForReading)
Open
s = 1 while s <> eof s = ts.ReadLine
if GetCSVCount(s) = 3 then
Num1 = GetCSVItem(s, 0)
Num2 = GetCSVItem(s, 1)
Ret = GetCSVItem(s, 2)
'msgbox(Num1 & "+" & Num2 & "=" & Ret)
Call Calc(Num1, Num2, Ret)
end if
wend
ts.Close
Close
End Sub
我有5条记录,可在读完之后还在继续读,然后就出错说
---------------------------
TestComplete
---------------------------
An exception occurred in the "Unit1" unit at line 50:
Microsoft VBScript 运行时错误
输入超出了文件尾
---------------------------
OK
---------------------------
请问,这里的while应该怎么写呀,怎么判断文件末尾,拜托了 作者: firefox82 时间: 2006-12-12 19:16
好像vbscript里没有eof的吧
Do While ts.AtEndOfLine <> True
s = ts.ReadLine
**************
**************
Loop作者: yang119345 时间: 2006-12-13 00:37
sdlkfj3 火狐狸太牛B了作者: binbin199 时间: 2006-12-13 12:32
谢谢