Solved

How can I delete a line in a text file?

Posted on 1998-02-05
1
153 Views
Last Modified: 2010-04-04
  I can use "Writeln" write a line and use "Readln" read a
line from a text file, but how can I delete a line?

                                    (Thanks a lot)
0
Comment
Question by:thecon
1 Comment
 

Accepted Solution

by:
TechStone earned 50 total points
ID: 1358400
The simple answer is, you can't.  Text files are written from the beginning to the end, and that's it.

In order to delete a line, you must read the file and write all lines but the one you wanted deleted to another file.  I know that sounds like a long way to do things, but that's how text files work.


0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

791 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