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
Total Hits: 3610
Total Votes: 36 votes
Average Rating: 2.5 out of 5
Category: ASP/File Manipulation
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 |
|---|---|---|
![]() |
![]() ![]() 16.67% |
6 |
![]() ![]() |
![]() ![]() 16.67% |
6 |
![]() ![]() ![]() |
![]() ![]() 16.67% |
6 |
![]() ![]() ![]() ![]() |
![]() ![]() 16.67% |
6 |
![]() ![]() ![]() ![]() ![]() |
![]() ![]() 16.67% |
6 |




16.67%

16.67%

16.67%

16.67%

16.67%