Shared Tutorials

Tutorials Shared by the Internet Community


  Top Tutorials     New Tutorials     Submit     Login     Register  

Tutorial Basic Detail

Write to a file with ASP and FSO

This tutorial will show you how use the File Scripting Object to both write to and append to a text file.


This is the code for APPENDING to a text file. This means what is already in the file will NOT be overwritten.

Dim Stuff, myFSO, WriteStuff
'this is what we will write in the file
Stuff = "Here is some stuff to write in the file."
'this line creates an instance of the File Scripting Object named myFSO
Set myFSO = CreateObject("Scripting.FileSystemObject")
'this line opens the file, notice the 8, it will cause the script to append to the file
Set WriteStuff = myFSO.OpenTextFile("C:\Inetpub\wwwroot\myNewFolder\myNewText.txt", 8, True)
'this line actually writes STUFF from above to the file
''this line closes the file
'this line destroys the instance of the File Scripting Object named WriteStuff
SET WriteStuff = NOTHING
'this line destroys the instance of the File Scripting Object named myFSO

Rating Detail

 Stars  Percentage  Total Vote
 One star  Vote LeftVote MiddleVote Right 37.58%  56
 Two starsTwo star  Vote LeftVote MiddleVote Right 10.74%  16
 Three starsThree starsThree stars  Vote LeftVote MiddleVote Right 12.08%  18
 Four starsFour starsFour starsFour stars  Vote LeftVote MiddleVote Right 11.41%  17
 Five starsFive starsFive starsFive starsFive stars  Vote LeftVote MiddleVote Right 28.19%  42

Caste Your Vote

 Rating  Selection  Guidelines
 Poor:     Very disappointing, useless.
 Fair:     Below average, disappointing but not useless.
 Good:     About average in its class.
 Very Good:     Above average for its category.
 Excellent:     One of the best Tutorials in its category.