欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

用asp实现读取文件的最后一行的代码

程序员文章站 2024-01-02 11:26:16
复制代码 代码如下:function fsolastline(filename) dim fso,f,temparray,tempcnt set fso = server....
复制代码 代码如下:

function fsolastline(filename)
dim fso,f,temparray,tempcnt
set fso = server.createobject("scripting.filesystemobject")
if not fso.fileexists(server.mappath(filename)) then exit function
set f = fso.opentextfile(server.mappath(filename),1)
if not f.atendofstream then
tempcnt = f.readall
f.close
set f = nothing
temparray = split(tempcnt,chr(13)&chr(10))
fsolastline = temparray(ubound(temparray))
end if
end function

上一篇:

下一篇: