Asp读取文本文件最后一行的函数:
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 |
文章作者
Nuclear'Atk
上次更新
2010-09-11
许可协议
Nuclear'Atk(核攻击)网络安全实验室版权所有,转载请注明出处。