How to create a text writer?

Source: Internet
Author: User

<%
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 ","China Water Conservancy and hydropower Press (Www.waterpub.com.cn) -- National Excellent Publishing House", True
WriteToFile "C: \ intels \ Test2.txt ","China Water Conservancy and hydropower Press (Www.waterpub.com.cn) -- National Excellent Publishing House", False
WriteToFile "C: \ intels \ Test1.txt", chr (13) & chr (10 )&"Dancing with the wind (Www.intels.net) -- Personal website of fashion Consulting", True
WriteToFile "C: \ intels \ Test2.txt", chr (13) & chr (10 )&"Dancing with the wind (Www.intels.net) -- Personal website of fashion Consulting", False

'Test1.txt contains:
'China Water Conservancy and hydropower Press (Www.waterpub.com.cn) -- National Excellent Publishing House
'Dancing with the wind (Www.intels.net) -- Personal website of fashion Consulting

'Test2. text contains:
'Dancing with the wind (Www.intels.net) -- Personal website of fashion Consulting
%>
Write to File test is complete
</Body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.