PDA

View Full Version : Creating and Writing to a Text File


admin
06-04-2003, 02:50 PM
When working with files you use the built in component: FileSystemObject. This component comes packed with lots of nice methods you can use to create, delete and manipulate files and folders. Here, we'll show how to Create and Write to a text file.

The code below will create a text file and then write to it...

<%
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set NewTextFile = FSO.OpenTextFile("c:\inetpub\wwwroot\stuff\morestuff.txt")
NewTextFile.WriteLine("Writing a line of text to a new file")
NewTextFile.WriteLine("Writing another line of text to a new file")

NewTextFile.WriteLine("And still more...")
NewTextFile.Close
Set NewTextFile = Nothing
%>