Share a definition and usage of ASP CreateTextFile

Source: Internet
Author: User

Definition and usage

The CreateTextFile method creates a new text file in the current folder and returns a TextStream object for reading and writing to this file.


Filesystemobject.createtextfile (Filename[,overwrite[,unicode]]) folderobject.createtextfile (filename[,overwrite [, Unicode]])

filename is required. The name of the file that needs to be created.

overwrite is optional. A Boolean value that indicates whether the existing file can be overwritten. True indicates that the file can be overwritten, and False indicates that the file cannot be overwritten. The default is True.

Unicode is optional. Indicates whether the file is created in Unicode or ASCII format. True indicates that the file is created in Unicode format, False indicates that the file is created in ASCII format. The default is False.


Examples of File objects

<%dim fs,tfileset fs=server.createobject ("Scripting.FileSystemObject") set TFILE=FS. CreateTextFile ("D:\somefile.txt") tfile. WriteLine ("Hello world!") Tfile.closeset Tfile=nothingset fs=nothing%>

Example for a Folder object

<%dim fs,fo,tfileset fs=server.createobject ("Scripting.FileSystemObject") Set Fo=fs. GetFolder ("D:\test") Set Tfile=fo. CreateTextFile ("Somefile.txt", false) Tfile. WriteLine ("Hello world!") Tfile. CloseSet Tfile=nothingset Fo=nothingset fs=nothing%>


1. asp FSO: Create a file CreateTextFile instance tutorial

2. CreateTextFile examples in FSO components

Related Article

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: 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.