如何做一个文本书写器?
<%
function writetofile(filename, contents, append)
on error resume next
if append = true then
imode = 8
else
imode = 2
end if
set ofs = server.createobject("scripting.filesystemobject")
set otextfile = ofs.opentextfile(filename, imode, true)
otextfile.write contents
otextfile.close
set otextfile = nothing
set ofs = nothing
end function
%>
<html>
<body>
<%
writetofile "c:\intels\test1.txt", "中国水利水电出版社(www.waterpub.com.cn)——全国优秀出版社", true
writetofile "c:\intels\test2.txt", "中国水利水电出版社(www.waterpub.com.cn)——全国优秀出版社", false
writetofile "c:\intels\test1.txt", chr(13) & chr(10) & "随风起舞(www.intels.net)——时尚咨询的个人网站", true
writetofile "c:\intels\test2.txt", chr(13) & chr(10) & "随风起舞(www.intels.net)——时尚咨询的个人网站", false
'test1.txt contains:
' 中国水利水电出版社(www.waterpub.com.cn)——全国优秀出版社
' 随风起舞(www.intels.net)——时尚咨询的个人网站
'test2.text contains:
' 随风起舞(www.intels.net)——时尚咨询的个人网站
%>
write to file test is complete
</body></html>
上一篇: 好像哪里不对
下一篇: 如何准确地获得一个整数?