473,395 Members | 1,948 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Deleting a line from a text file.


I am making a program that will take a while to run. What the program
does is read a text file line update some information and then read
the next line. The problem is this program will run at the end of the
night and the user may shut off their computer before this is
finished. How can I read the first record in the file and then delete
the record I just read after I updated some information. I will want
to do this for every record in the file. I want to make sure if the
user shuts off the computer I can start the program on the next file.
Thank you for any help.
Jul 23 '08 #1
2 891
Hello id10t,

You could create a file which contains the file name of the last file
that was read. This way you just read in that file (which just contains
1 file name) and find that file name in the file list. Then, continue
with the next file from the file list.

Best regards,

Martin

On 24.07.2008 04:50, wrote id10t error:
I am making a program that will take a while to run. What the program
does is read a text file line update some information and then read
the next line. The problem is this program will run at the end of the
night and the user may shut off their computer before this is
finished. How can I read the first record in the file and then delete
the record I just read after I updated some information. I will want
to do this for every record in the file. I want to make sure if the
user shuts off the computer I can start the program on the next file.
Thank you for any help.
Jul 23 '08 #2
Martin,

That is a very good idea. I will look into that and see how i can try
to make that work.


On Jul 23, 6:37*pm, "Martin H." <hk...@gmx.netwrote:
Hello id10t,

You could create a file which contains the file name of the last file
that was read. This way you just read in that file (which just contains
1 file name) and find that file name in the file list. Then, continue
with the next file from the file list.

Best regards,

Martin

On 24.07.2008 04:50, wrote id10t error:
I am making a program that will take a while to run. What the program
does is read a text file line update some information and then read
the next line. The problem is this program will run at the end of the
night and the user may shut off their computer before this is
finished. How can I read the first record in the file and then delete
the record I just read after I updated some information. I will want
to do this for every record in the file. *I want to make sure if the
user shuts off the computer I can start the program on the next file.
Thank you for any help.- Hide quoted text -

- Show quoted text -
Jul 23 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Thaynann | last post by:
is there a way to delete a block of text i have started by looking for the speicific line of text that starts the block by looking for teh index of it...but i cannot figure out out to remove...
2
by: GMK | last post by:
Dear all in my asp.net application i have a text file that is installed with my application on the server. this text file is filled with data through a web interface in my application. i need to...
2
by: angus | last post by:
hello everybody, i'm having some problems searching a text file and then deleting the line. since i used fileopen(), i can use the eof() function to loop through the file, searching for the...
5
by: Joe Delphi | last post by:
Hi Newbie to VB.Net and I have a question I need to open a text file, read each line, and if I find something in the line, delete that line from the text file. Can anyone tell me how to do...
2
by: SiouxieQ | last post by:
Hi there, I'm using the code below to try to delete a name from a list of names in a file. Unfortunately it doesn't quite do what I want it to. Instead of looking for the name in the...
13
by: programming | last post by:
how do i delete from a text file 1 of the following lines: jon|scott adam|smith <--delete paul|clark say i would like to delete the middle line of this txt, in member.txt what php code or...
8
by: Horacius ReX | last post by:
Hi, I need to write a program which reads an external text file. Each time it reads, then it needs to delete some lines, for instance from second line to 55th line. The file is really big, so...
2
by: helraizer1 | last post by:
Hi folks, I have a file for my chatbox called data.line, which the posts are in the layout CHATBOXTEXT 7 username=helraizer 1202416953
10
by: Faisal Shah | last post by:
HI, Well, Here is the code of my new project .. Actually it's just s scrap or it.. I have made 2 files. the 1st file is test.php with of course creating a new file called testdb.txt. And...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.