Latest web development tutorials

Metoda ASP CreateTextFile

FileSystemObject Object Reference Kompletna FileSystemObject Object Reference

Metoda CreateTextFile aby utworzyć nowy plik tekstowy w bieżącym folderze i powrót może być używany do odczytu lub zapisu pliku TextStream obiektu.

gramatyka

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

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

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


Na przykład FileSystemObject obiektu

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

Na przykład obiekt 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 Object Reference Kompletna FileSystemObject Object Reference