Page 1 of 1

Changing Textfiles

PostPosted: October 10th, 2007, 10:12 am
by melted.marsbar
Hey guys, my first post! I'm doing Delphi programming at school at the moment - I'm pretty good, but I do have a couple of questions from time to time. So I thank you in advance for your assistance.

First one for today :)

How do I change the data in textfiles? I know how to add data to it and completely clear it, but how to I write over the text on a line? Say I have this text file:

Code: Select all
John Smith
100
200
300


How do I change "200" to say "400"?

Thanks! melted.marsbar

PostPosted: October 10th, 2007, 3:20 pm
by Kambiz
As a text file, you have to read the entire file, change the line you want, and write the entire data back to file.

PostPosted: October 11th, 2007, 11:07 am
by melted.marsbar
Ah okay. Well in that case, I shall use an array =) Thanks!