当前位置: 首页 > 网络学院 > 服务端脚本教程 > ASP > ASP CreateTextFile 方法

ASP
ASP 介绍
ASP Install
ASP 语法
ASP 变量
ASP Procedures
ASP Forms
ASP Cookies
ASP Session
ASP Application
ASP #include
ASP Global.asa
ASP Send e-mail
ASP Response
ASP Request
ASP Application
ASP Session
ASP Server
ASP Error
ASP FileSystem
ASP TextStream

ASP CreateTextFile 方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 343 ::
收藏到网摘: n/a

The CreateTextFile method creates a new text file in the current folder and returns a TextStream object that can be used to read from, or write to the file.
ASP CreateTextFile用于在现存的文件夹中建立一个新的文本文件并且返回一个文本流对象,这个文本流对象是用来读取文件中的内容或者向文件中写内容。

Syntax
语法

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

Parameter参数 Description描述
filename Required. The name of the file to create
必要组件。确定建立文件的名称
overwrite Optional. A Boolean value that indicates whether an existing file can be overwritten. True indicates that the file can be overwritten and False indicates that the file can not be overwritten. Default is True
可选组件。它是一个逻辑值,用于设定是否拥有覆盖现存文件夹的权限。如果值为“true真”,则可以覆盖现存文件夹;如果是“false假”,则不可以覆盖。默认时为:true真
unicode Optional. A Boolean value that indicates whether the file is created as a Unicode or an ASCII file. True indicates that the file is created as a Unicode file, False indicates that the file is created as an ASCII file. Default is False
可选组件。它是一个逻辑值,用于设定是否可以建立一个Unicode文件或者是ASCII文件。如果值为“true真”,则允许建立一个Unicode文件;如果是“false假”,则允许建立一个ASCII文件。默认时为:False假。

Example for the FileSystemObject object
FileSystemObject对象举例

<%
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
%>

Example for the Folder object
Folder对象举例

<%
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
%>

评论 (0) All

登陆 | 还没注册?