[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
ASPFAQ_WriteTextFile
Back to ASP FAQ Main Page.

How to write to a textfile


This example will show you how to write to a textfile in ASP.

<%
'How to write to a textfile example
'
'(c) 2001 Programmers Heaven
'http://www.programmersheaven.com

const ForAppending=8
const TristateFalse=0
dim f,fsobj,filename
'Create a filesystem object   
Set fsobj = CreateObject("Scripting.FileSystemObject")
'The path and filename to write to
filename="c:\testfile.txt"
'Open the textfile, create a new if it does not already exist
Set f = fsobj.OpenTextFile(filename, ForAppending,true,TristateFalse)
'Write to textfile
f.Writeline "This is a test!"
'Close the file
f.Close
'Free the objects
set f=nothing
set fsobj=nothing
%>


last edited (December 9, 2002) by KDivad Leahcim, Number of views: 1955, Current Rev: 2 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.