Solved

How to append text to a file in asp without overwriting it?

Posted on 1998-03-26
2
158 Views
Last Modified: 2013-12-25
I want to append text to a file within asp. I am trying to open the textfile for appending but I can't. I can only open it for writing which obviously rewrites the whole file erasing its previous contents. I have tried the "ForAppending" parameter (value 3) but it doesn't work.

Any ideas on the subject? Any reasons why it doesn't work?
Any workaround you know?


I'd really appreciate your help.



Thank you very much.
0
Comment
Question by:manuelf
2 Comments
 

Accepted Solution

by:
juliomb earned 20 total points
ID: 1832217
Your problem it's the mode of openfile, "ForAppending it's value '8' not '3'

Please, test this code.

-----------------------------------

' Create Object
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")

' Open Scream por Append

  Set OutStream= FileObject.OpenTextFile ("file_name", 8)

  OutputString = "your text to append"

  OutStream.WriteLine OutputString

'Clear
  Set OutStream = Nothing
-----------------------------------
0
 

Author Comment

by:manuelf
ID: 1832218
This morning I had already found the right value (8) but thanks a lot anyway julio.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Ever wondered how to display how many visitors you have online. In this tutorial I will show you an easy but effective way to display the number of online visitors in WhizBase. In this article I assume you have read my previous articles and know …
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now