使用 fso 修改文件特定内容的函数
functionfsochange (파일 이름, 대상, 문자열)
dimobjfso, objcountfile, filetempdata
setobjfso = server.createobject ( "scripting.filesystemobject")
setobjcountfile = objfso.opentextfile (server.mappath (filename), 1, true)
filetempdata = objcountfile.readall
objcountfile.close
filetempdata = replace (filetempdata, target, string)
setObjCountFile = objfso.createTxtFile (Server.Mappath (Filename), True)
objcountfile.writeFileTempData
objcountfile.close
setobjcountfile = 아무것도 없습니다
setobjfso = 아무것도
최종 기능 장애
使用 fso 读取文件内容的函数
functionfsofileread (filename)
dimobjfso, objcountfile, filetempdata
setobjfso = server.createobject ( "scripting.filesystemobject")
setobjcountfile = objfso.opentextfile (server.mappath (filename), 1, true)
fsofileread = objcountfile.readall
objcountfile.close
setobjcountfile = 아무것도 없습니다
setobjfso = 아무것도
최종 기능 장애
使用 fso 读取文件某一行的函数
functionfsolinedit (filename, linenum)
iflinenum <1thenexitfunction
Dimfso, F, Temparray, tempcnt
setfso = server.createobject ( "scripting.filesystemobject")
ifnotfso.fileExists (server.mappath (filename)) exitfunction
setf = fso.opentextfile (Server.mappath (filename), 1)
ifnotf.atendofstreamthen
tempcnt = f.readall
f.close
setf = 아무것도
temparray = split (tempcnt, chr (13) & chr (10))
iflinenum> ubound (temparray)+1then
종료 기능
또 다른
fsolinedit = temparray (linenum-1)
endif
endif
최종 기능 장애
使用 fso 写文件某一行的函数
functionfsolinewrite (filename, linenum, linecontent)
iflinenum <1thenexitfunction
Dimfso, F, Temparray, tempcnt
setfso = server.createobject ( "scripting.filesystemobject")
ifnotfso.fileExists (server.mappath (filename)) exitfunction
setf = fso.opentextfile (Server.mappath (filename), 1)
ifnotf.atendofstreamthen
tempcnt = f.readall
f.close
temparray = split (tempcnt, chr (13) & chr (10))
iflinenum> ubound (temparray)+1then
종료 기능
또 다른
temparray (linenum-1) = Linecontent