国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

FSO一些代碼

2024-05-04 11:02:56
字體:
來源:轉載
供稿:網友
使用FSO修改文件特定內容的函數 
function FSOchange(filename,Target,String) 
Dim objFSO,objCountFile,FiletempData 
Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 
Set objCountFile = objFSO.OpenTextFile(Server.MapPath(filename),1,True) 
FiletempData = objCountFile.ReadAll 
objCountFile.Close 
FiletempData=Replace(FiletempData,Target,String) 
Set objCountFile=objFSO.CreateTextFile(Server.MapPath(filename),True) 
objCountFile.Write FiletempData 
objCountFile.Close 
Set objCountFile=Nothing 
Set objFSO = Nothing 
End Function 


使用FSO讀取文件內容的函數 
function FSOFileRead(filename) 
Dim objFSO,objCountFile,FiletempData 
Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 
Set objCountFile = objFSO.OpenTextFile(Server.MapPath(filename),1,True) 
FSOFileRead = objCountFile.ReadAll 
objCountFile.Close 
Set objCountFile=Nothing 
Set objFSO = Nothing 
End Function 


使用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 


使用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 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 高邑县| 广饶县| 勐海县| 青浦区| 澄江县| 老河口市| 竹溪县| 卓尼县| 平武县| 东方市| 保靖县| 化德县| 都匀市| 阳春市| 太保市| 三都| 凤冈县| 玉环县| 新兴县| 南充市| 太白县| 岢岚县| 古丈县| 文成县| 昭苏县| 平度市| 谢通门县| 平舆县| 巨野县| 宾阳县| 格尔木市| 肥东县| 平武县| 息烽县| 印江| 扶沟县| 淮北市| 肃南| 乡宁县| 甘南县| 宜春市|