Building WebApps  «Prev  

Writing to Text File

Write Text File
Classic ASP - Write Text File

Set fileSys = Server.CreateObject("Scripting.FileSystemObject")
This line instantiates the FileSystemObject

  textFileName = "c:\testfile.txt"
Set textStream = fileSys.CreateTextFile(textFileName, True)
These lines specify the name of the file to be created, establishing a new TextStream to that file. The "True" indicates that any existing file of the same name is to be overwritten. (False is the default if it is left blank.)
textStream.WriteLine("Just writin' a little text.")
This is the text to be written to the file
textStream.Close
This closes the text stream and the file