FSO组件中CreateTextFile实例详解

零下一度
Release: 2017-05-19 14:07:59
Original
3005 people have browsed it

FSO组件之CreateTextFile方法介绍,感兴趣的小伙伴们可以学习一下 

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

  参数:object

  必选项。 应为 FileSystemObject 或 Folder 对象的名称。

  filename

  必选项。 指明所要创建文件的字符串表达式。

  overwrite

  可选项。 Boolean 值,指明能否覆盖已有文件。 如果文件可以覆盖,则值为 true ,否则为 false 。 如果忽略,则已有文件不能被覆盖。

  unicode

  可选项。 Boolean 值,指明文件是否以 Unicode 或 ASCII 文件方式创建。 如果文件作为 Unicode 文件创建,则值为 true ,如果作为 ASCII 文件创建,则为 false。 如果忽略,则假定为 ASCII 文件。

  说明

  下面的代码说明了如何使用 CreateTextFile 方法来创建和打开一个文本文件。

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

  如果 overwrite 参数是 false ,或者没有提供这个参数,那么对于已有的 filename 将产生一个错误。

【相关推荐】

1. 分享一篇ASP CreateTextFile 的定义和用法

2. asp fso:创建文件 CreateTextFile 实例教程

The above is the detailed content of FSO组件中CreateTextFile实例详解. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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 [email protected]
Popular Tutorials
More>
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!