Shared Tutorials

Tutorials Shared by the Internet Community

Advertisements

  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.
http://nuts4asp.com/tutorials/WriteFile/index.asp

Description:

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
WriteStuff.WriteLine(Stuff)
''this line closes the file
WriteStuff.Close
'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
SET myFSO = NOTHING
%>

Rating Detail

 Stars  Percentage  Total Vote
 One star  Vote LeftVote MiddleVote Right 38.19%  55
 Two starsTwo star  Vote LeftVote MiddleVote Right 10.42%  15
 Three starsThree starsThree stars  Vote LeftVote MiddleVote Right 11.81%  17
 Four starsFour starsFour starsFour stars  Vote LeftVote MiddleVote Right 11.11%  16
 Five starsFive starsFive starsFive starsFive stars  Vote LeftVote MiddleVote Right 28.47%  41

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.





Advertisements