国产探花免费观看_亚洲丰满少妇自慰呻吟_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 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 师宗县| 南靖县| 锡林浩特市| 孟州市| 河西区| 北宁市| 定兴县| 宣汉县| 荣昌县| 广丰县| 黄大仙区| 东阿县| 营山县| 湟源县| 四子王旗| 出国| 崇信县| 偏关县| 西和县| 龙口市| 扎赉特旗| 华阴市| 正阳县| 本溪市| 随州市| 鸡东县| 镇坪县| 册亨县| SHOW| 商丘市| 伊川县| 富源县| 马公市| 定襄县| 天峻县| 桃园县| 泰安市| 女性| 西峡县| 云阳县| 托克逊县|