网络编程
位置:首页>> 网络编程>> Asp编程>> 如何做一个文本书写器?

如何做一个文本书写器?

  发布时间:2010-07-12 18:58:00 

标签:文本,asp,函数

如何做一个文本书写器?

我们有下面的的函数,可做“文本书写器”:

<%
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) & "asp之家(www.aspxhome.com)", true
WriteToFile "C:\intels\Test2.txt", chr(13) & chr(10) & "词典网(www.cidianwang.com)", false
'Test1.txt contains:
'中国水利水电出版社(www.waterpub.com.cn)——全国优秀出版社
'随风起舞(www.intels.net)——时尚咨询的个人网站
'Test2.text contains:%>
Write to File test is complete
</BODY>
</HTML>

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com