Writing to a text file

Results 1 to 3 of 3

Thread: Writing to a text file

  1. #1
    Join Date
    Dec 1969

    Default Writing to a text file

    I&#039;m trying to create a log for my program. I think I&#039;ll use just a simple text file, but I&#039;m not exactly sure how to write to it. How can I write single-line messages to a text file within my ASP script?<BR><BR>Mat

  2. #2
    nameless Guest

    Default Straight from the FAQ's...

    Check out the ASP FAQ&#039;s under FileSystemObject for more info than what I posted below, if you need it.<BR><BR>The following shows some very simple code that will create a text file named C:MyDirectoryfoo.txt with the contents Hello, World!.<BR><BR><BR>&#060;%<BR> &#039;Create our FSO and TextStream objects<BR> Dim objFSO, objTS<BR> Set objFSO = Server.CreateObject("Scripting.FileSystemObject")< BR><BR> &#039;Create the text file<BR> Set objTS = objFSO.CreateTextFile("C:MyDirectoryfoo.txt")<BR>< BR> &#039;Write "Hello, World" to the file<BR> objTS.WriteLine("Hello, World!")<BR><BR> &#039;Clean up!<BR> objTS.Close<BR> Set objTS = Nothing<BR> Set objFSO = Nothing<BR>%&#062;<BR> <BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default Thanks

    I really should look at those.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts