使用 fso 修改文件特定内容的函数
functionFsochange (Dateiname, Ziel, String)
Dimobjfso, objcountfile, fileTempdata
SetObjfso = server.createObject ("scripting.filesystemObject")
SetObjcountfile = objfso.opentextfile (server.mappath (Dateiname), 1, true)
FiletempData = objcountFile.readall
objcountfile.close
FiletempData = Ersetzen (FilETEMPDATA, Ziel, String)
SetObjcountfile = objfso.createTextFile (Server.Mappath (Dateiname), True)
objcountfile.writeFiletempdata
objcountfile.close
SetObjcountfile = nichts
SetObjfso = nichts
Endfunktion
使用 fso 读取文件内容的函数
functionFSoFileread (Dateiname)
Dimobjfso, objcountfile, fileTempdata
SetObjfso = server.createObject ("scripting.filesystemObject")
SetObjcountfile = objfso.opentextfile (server.mappath (Dateiname), 1, true)
FSoFileread = objcountFile.readall
objcountfile.close
SetObjcountfile = nichts
SetObjfso = nichts
Endfunktion
使用 fso 读取文件某一行的函数
functionFSolinedit (Dateiname, Leinenum)
IFLINENUM <1Thenexitfunction
Dimfso, F, Temparray, tempcnt
setfso = server.createObject ("scripting.filesystemObject")
ifnotfso.FileExists (server.mappath (Dateiname)) Thenexitfunction
setf = fso.opentextFile (server.mappath (Dateiname), 1)
ifnotf.atendofstreamthen
tempcnt = f.readall
F.CLOSE
setf = nichts
tempArray = split (tempcnt, chr (13) & chr (10))
IFLINENUM> UBOUND (TEMPARRAY)+1Then
Ausgangsfunktion
anders
FSolinedit = temparray (linenum-1)
Endif
Endif
Endfunktion
使用 fso 写文件某一行的函数
functionFsolineWrite (Dateiname, Leinenum, linecontent)
IFLINENUM <1Thenexitfunction
Dimfso, F, Temparray, tempcnt
setfso = server.createObject ("scripting.filesystemObject")
ifnotfso.FileExists (server.mappath (Dateiname)) Thenexitfunction
setf = fso.opentextFile (server.mappath (Dateiname), 1)
ifnotf.atendofstreamthen
tempcnt = f.readall
F.CLOSE
tempArray = split (tempcnt, chr (13) & chr (10))
IFLINENUM> UBOUND (TEMPARRAY)+1Then
Ausgangsfunktion
anders
temparray (linenum-1) = linecontent