Open In App

ASP CreateTextFile Method

The ASP CreateTextFile Method is used to create a new Text file in the current Directory It returns a TextStream Object which can be used to read and write the contents to a File. 

Syntax:



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

Parameter Values:

Example: Below code demonstrates the ASP CreateTextFile Method. 






<%
dim fs,tfile
set fs=Server.CreateObject("Scripting.FileSystemObject")
set tfile=fs.CreateTextFile("e:\GeeksGFG.txt"
tfile.WriteLine("Hello GeeksForGeeks!")
tfile.close
Response.write("File is closed")
set tfile=nothing
set fs=nothing
%>

Output:

File is closed
Article Tags :