2008/01/13 12:26
Function getfile(filename)
dim f
if fso.fileExists(server.MapPath(filename)) then
set f = fso.OpenTextFile(server.MapPath(filename))
Response.write f.ReadAll
set f = nothing
end if
End Function
dim f
if fso.fileExists(server.MapPath(filename)) then
set f = fso.OpenTextFile(server.MapPath(filename))
Response.write f.ReadAll
set f = nothing
end if
End Function
调用时出现:
Microsoft VBScript 运行时错误 错误 '800a003e'
输入超出了文件尾
/function.asp,行35
第35行就是Response.write f.ReadAll这句。
这是一段读取已经存在的文件,并输出文件内容的函数。但当这个文件没有内容时,就会出这种错误提示。
查了文档,ReadAll不会自己判断是否到文件尾,只好,加了个atendofstream的判断语句,测试OK。
更改后的代码为
Function getfile(filename)
dim f
if fso.fileExists(server.MapPath(filename)) then
set f = fso.OpenTextFile(server.MapPath(filename))
if not f.atendofstream then
Response.write f.ReadAll
end if
set f = nothing
end if
End Function
dim f
if fso.fileExists(server.MapPath(filename)) then
set f = fso.OpenTextFile(server.MapPath(filename))
if not f.atendofstream then
Response.write f.ReadAll
end if
set f = nothing
end if
End Function

用IE修改当前页面内容的代码
anytree好像倒闭了

