Home >Backend Development >C#.Net Tutorial >Detailed explanation of CreateTextFile instance in FSO component

Detailed explanation of CreateTextFile instance in FSO component

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

Introduction to the CreateTextFile method of the FSO component, interested friends can learn about it 

object.CreateTextFile(filename[, overwrite[, unicode]])

 Parameter: object

Required option. Expected to be the name of a FileSystemObject or Folder object.

 filename

 Required option. A string expression that specifies the file to be created.

 overwrite

Optional. Boolean value indicating whether existing files can be overwritten. The value is true if the file can be overwritten, false otherwise. If omitted, existing files cannot be overwritten.

 unicode

Optional. Boolean value indicating whether the file was created as a Unicode or ASCII file. The value is true if the file was created as a Unicode file, false if it was created as an ASCII file. If omitted, an ASCII file is assumed.

 Description

 The following code illustrates how to use the CreateTextFile method to create and open a text file.

 var fso = new ActiveXObject("Scripting.FileSystemObject");
  var a = fso.CreateTextFile("c:testfile.txt", true);
  a.WriteLine("This is a test.");
  a.Close();

If the overwrite parameter is false, or this parameter is not provided, an error will be generated for the existing filename.

【Related recommendations】

1. Share an article about the definition and usage of ASP CreateTextFile

2. asp fso: Create fileCreateTextFile example tutorial

The above is the detailed content of Detailed explanation of CreateTextFile instance in FSO component. 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