Home | Advertising Info77 USERS CURRENTLY ONLINE   
   Site Search Contact Us Friday, March 14, 2025  
 
 


 
ASPProtect
User Management Application with web based screens that allow you to manage users.
www.ASPProtect.com
 
ASPBanner
Banner Rotation system. Advertisers can monitor online statistical reports via their web browsers.
www.ASPBanner.com
 
ASP Photo Gallery
Upload an unlimited amount of albums. Set up categories.Image resizing thumbnail creation.
www.ASPPhotoGallery.com
 
ASPClassifieds
Classifieds system. Set up categories. Users can register themselves. Supports picture uploads.
www.ASPClassifieds.com



DISCUSSION ARCHIVES
 



We didn't realize
the site was so popular.

Other Stuff
 

 
 
Active Server Pages help tutorial how to ASP Help ASP Tutorials ASP Programming ASP Code - ASP Free CJWSoft ASPProtect ASPBanner ASPClassifieds



(Advanced)  (Components)  (Database)  (General)  (Vbscript)




ASPProtect

 
Subject: Re: Need help with writing Text Files!
From: Pete
Date: 3/9/1999 7:46:44 AM
IP: 193.133.140.50



 

To do what you asking you would first have to create a new file, write you new line to that file and then write the oldfile to the botton of it. I assume that you would want to have the new file have the same name as the old one so I've shown how to rename them by copying the files back over. I don't use the FileSystemObject that much myself so this might not work first time, for instance you may have to reopen the newfile in append mode when copying the oldfile over to it, have a play around. I learnt all this info from the VBScript site at microsoft : http://msdn.microsoft.com/scripting/default.htm

Heres the code:

' To insert your new line at the top of a file
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, oldfile, newfile, renamefile
Set fso = CreateObject("Scripting.FileSystemObject")
Set newfile = fso.OpenTextFile("c:\newfile.txt", 1, ForWriting, True)
newfile.Write "You new 1st line of text"
Set oldfile = fso.OpentextFile("c:\oldfile.txt", ForReading, True)
newfile.Write oldfile.readall
newfile.Close
oldfile.Close

' To over write the old file with the new file
fso.CopyFile "c:\newfile.txt", "c:\oldfile.txt"
fso.DeleteFile "c:\newfile.txt"

Pete

Previous Message


 

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright © 1998 - 2025 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

Active Server Pages help tutorial how to ASP Help ASP Tutorials ASP Programming ASP Code - ASP Free CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspclassifieds.com, www.powerasp.com,www.cjwsoft.com,www.aspphotogallery.com,www.codewanker.com,www.aspprotect.com,www.aspbanner.com