Share the definition and usage of ASP CreateTextFile

零下一度
Release: 2017-05-19 14:10:02
Original
1715 people have browsed it

Definition and Usage

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

Syntax:

FileSystemObject.CreateTextFile(filename[,overwrite[,unicode]])FolderObject.CreateTextFile(filename[,overwrite[,unicode]])
Copy after login

filenameRequired. The name of the file that needs to be created.

overwriteOptional. A Boolean value indicating whether existing files can be overwritten. True means the file can be overwritten, False means the file cannot be overwritten. The default is True.

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

Example

Example for File object

<% dim fs,tfile set fs=Server.CreateObject("Scripting.FileSystemObject") set tfile=fs.CreateTextFile("d:\somefile.txt")tfile.WriteLine("Hello World!") tfile.close set tfile=nothing set fs=nothing %>
Copy after login

For Folder object Example

<% dim fs,fo,tfile Set fs=Server.CreateObject("Scripting.FileSystemObject") Set fo=fs.GetFolder("d:\test") Set tfile=fo.CreateTextFile("somefile.txt",false)tfile.WriteLine("Hello World!") tfile.Close set tfile=nothing set fo=nothing set fs=nothing %>
Copy after login

[Related recommendations]

1.asp fso: Create file CreateTextFile example tutorial

2.Detailed explanation of CreateTextFile instance in FSO component

The above is the detailed content of Share the definition and usage of ASP CreateTextFile. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!