自强学堂
自强学堂:学习、分享、让你更强!
ASP 实例HTMLCSSJAVASCRIPTJQUERYSQLPHPBOOTSTRAPANGULARXML
 

ASP CreateTextFile 方法

FileSystemObject 对象参考手册 完整的 FileSystemObject 对象参考手册

CreateTextFile 方法可在当前文件夹中创建新的文本文件,并返回可用于读或写文件的 TextStream 对象。

语法

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

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

参数描述
filename 必需的。需创建文件的名称。
overwrite 可选的。指示能否覆盖已有文件的布尔值。True 指示可覆盖文件,False 指示不能覆盖文件。默认是 True 。
unicode 可选的。指示文件是作为 Unicode 还是 ASCII 文件来创建的布尔值。True 指示文件作为 Unicode 文件创建,False 指示文件作为 ASCII 文件创建。默认是 False。


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

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


FileSystemObject 对象参考手册 完整的 FileSystemObject 对象参考手册