网络编程
位置:首页>> 网络编程>> Asp编程>> 用asp实现读取文件的最后一行的代码

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

 来源:asp之家 发布时间:2011-03-08 10:55:00 

标签:文件,最后一行

代码如下:


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 

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com