ASP常用函数收藏乱七八糟未整理版(50)
objCountFile.Close
Set objCountFile = Nothing
Set objFSO = Nothing
End Function
%>
18.使用FSO读取文件某一行的函数
<%
Function FSOlinedit(filename, lineNum)
If linenum < 1 Then Exit Function
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))
If lineNum>UBound(temparray) + 1 Then
Exit Function
Else
FSOlinedit = temparray(lineNum -1)
End If
End If
End Function
%>
19.使用FSO写文件某一行的函数
<%
Function FSOlinewrite(filename, lineNum, Linecontent)
If linenum < 1 Then Exit Function
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
temparray = Split(tempcnt, Chr(13)&Chr(10))
If lineNum>UBound(temparray) + 1 Then
Exit Function
Else
temparray(lineNum -1) = lineContent
内容版权声明:除非注明,否则皆为本站原创文章。