时间:2021-08-13 点击: 次 来源:网络 添加者:佚名 - 小 + 大
function FSOlastline(filename)
或者另外一段代码 Function getLastLine(fileName) Dim fso,srcFileContent,tempLine ForReading = 1 FileName = Server.MapPath(FileName) Set fso = CreateObject("Scripting.FileSystemObject") If fso.FileExists(fileName) Then Set srcFile = fso.OpenTextFile(fileName, ForReading) While Not srcFile.AtEndOfStream tempLine = srcFile.ReadLine Wend Set srcFile = Nothing Set fso = Nothing getLastLine = tempLine Else getLastLine = "file not exists" '当文件不存在时返回此错误 End If End Function
|