Home  >  Article  >  Backend Development  >  asp fso: create file CreateTextFile example tutorial

asp fso: create file CreateTextFile example tutorial

零下一度
零下一度Original
2017-05-19 14:05:411874browse

asp fso: Create File CreateTextFile Example Tutorial

TheCreateTextFile method creates a new text file in the current folder and returns a TextStream object, which can be used to read or write into the file.
Grammar

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

Tutorial on operating files.

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

Tutorial on operating folders.

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

The above is the content carefully prepared by the editor for you. There is also related content in the editor's blog, Q&A, public account, people, courses and other columns. You are welcome to continue to use the search button in the upper right corner to search for files.

【Related recommendations】

1. Detailed explanation of CreateTextFile instance in FSO component

2. Share an article about ASP CreateTextFile Definition and usage

The above is the detailed content of asp fso: create file CreateTextFile example tutorial. For more information, please follow other related articles on the PHP Chinese website!

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