使用 fso 修改文件特定内容的函数
FunctionFSoChange (اسم الملف ، الهدف ، السلسلة)
Dimobjfso ، objcountfile ، fileTempdata
setobjfso = server.createBject ("scripting.filesystemObject")
setObjCountFile = objfso.opentextFile (server.mappath (اسم الملف) ، 1 ، صحيح)
fileTempdata = objcountfile.readall
objcountfile.close
FileTempdata = استبدال (FileTempdata ، الهدف ، السلسلة)
setObjCountFile = objfso.createTextFile (server.mappath (filename) ، true)
objcountfile.writefiletempdata
objcountfile.close
setObjCountFile = لا شيء
setobjfso = لا شيء
الوظيفية
使用 fso 读取文件内容的函数
FunctionFsoFileread (اسم الملف)
Dimobjfso ، objcountfile ، fileTempdata
setobjfso = server.createBject ("scripting.filesystemObject")
setObjCountFile = objfso.opentextFile (server.mappath (اسم الملف) ، 1 ، صحيح)
fsofileread = objcountfile.readall
objcountfile.close
setObjCountFile = لا شيء
setobjfso = لا شيء
الوظيفية
使用 fso 读取文件某一行的函数
FunctionFsolinedIt (اسم الملف ، الكتان)
iflinenum <1thenexitfunction
Dimfso ، F ، Temparray ، Tempcnt
setfso = server.createObject ("scripting.filesystemObject")
ifnotfso.filexists (server.mappath (filename)) thenexitfunction
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
exitfunction
آخر
fsolinedit = temparray (الكتان 1)
Endif
Endif
الوظيفية
使用 fso 写文件某一行的函数
FunctionFsolineWrite (اسم الملف ، الكتان ، linecontent)
iflinenum <1thenexitfunction
Dimfso ، F ، Temparray ، Tempcnt
setfso = server.createObject ("scripting.filesystemObject")
ifnotfso.filexists (server.mappath (filename)) thenexitfunction
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
exitfunction
آخر
Temparray (Linenum-1) = linecontent