编写一个ASP程序,可以打开指定的文件,并读出该文件的内容,然后写入另一个新的文本文件中 15
展开全部
function readfile(sfile)
dim fso,objfiles
set fso=server.CreateObject("scripting.filesystemobject")
set objfiles=fso.opentextfile(sfile)
readfile=objfiles.readall
end function
function writefile(filepath,content)
response.write content
dim fso,htmlwrite
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set htmlwrite=fso.CreateTextFile(filepath,true)
'// 写入网页内容
htmlwrite.Write(content)
htmlwrite.close
set htmlwrite=Nothing
set fso=Nothing
htmlwrite=1
end function
例读取C:\a.txt写入C:\b.txt
writefile("c:\b.txt",readfile("c:\a.txt"))
dim fso,objfiles
set fso=server.CreateObject("scripting.filesystemobject")
set objfiles=fso.opentextfile(sfile)
readfile=objfiles.readall
end function
function writefile(filepath,content)
response.write content
dim fso,htmlwrite
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set htmlwrite=fso.CreateTextFile(filepath,true)
'// 写入网页内容
htmlwrite.Write(content)
htmlwrite.close
set htmlwrite=Nothing
set fso=Nothing
htmlwrite=1
end function
例读取C:\a.txt写入C:\b.txt
writefile("c:\b.txt",readfile("c:\a.txt"))
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询