Open a Text File   
 

Example One:  Creating a text file through ASP

Creates a text file in a specific directory.
In the 4th line of code just specify how the file gets opened up.  Every time the ASP page gets opened up it will create a new file and overwrite any existing data!

<%
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)
f.Write "Hello world!"

%>

Example Two: Appending to a text file through ASP

Appends to a text file in a specific directory.
In the 4th line of code just specify how the file gets opened up.  Every time the ASP page gets opened up it will create a new file and append new data to the existing file!

<%
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\testfile.txt", ForAppending, True)
f.Write "Hello world!"

%>


My3C's
perrychicker
It's easy... it's a PSACAKE!
Back | Tell A Friend | Search this Site
© 1998 - 2008 psacake.com
Version 3.23

Send me One Million FREE Guaranteed Visitors