日期:2014-05-16 浏览次数:20939 次
set fs=server.createobject("scripting.filesystemobject")
file=server.mappath("qq.txt")
set txt=fs.opentextfile(file,1,true)
do while Not txt.AtEndOfStream
rline =txt.ReadLine'读取一行
respinse.write rline&"<br>"
loop
TxtFileName = "new.txt" '要保存的文本文件名
Set fso = CreateObject("Scripting.FileSystemObject") '建立fso对象
Set MyFile = fso.CreateTextFile(Server.mapPath(TxtFileName), True) '建立对象
MyFile.WriteLine str '将str的值写入文本文件,即上面内容组合而成的新的内容
MyFile.Close '关闭对象
set MyFile=nothing '释放对象空间
'读文件
public function LoadFile(path,charset)
dim stream
set stream = server.createobject("adodb.stream")
stream.mode = 3
stream.type=2
stream.charset=charset
stream.open
stream.loadfromfile path
LoadFile = stream.readtext()
stream.close
set stream = nothing
end function
'写文件
public function SaveFile(path,content,charset)
dim stream
set stream = server.createobject("adodb.stream")
stream.mode = 3
stream.type=2
stream.charset=charset
stream.open
stream.writetext(content)
stream.savetofile path,2
stream.close
set stream = nothing
end function