当前位置: 移动技术网 > IT编程>开发语言>其他编程 > 如何做一个文本书写器?

如何做一个文本书写器?

2017年12月08日  | 移动技术网IT编程  | 我要评论

<%
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>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网