Solved

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

Posted on 1998-03-26
2
166 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

756 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