## Changing Textfiles

Please discuss general Delphi programming topics here.

### Changing Textfiles

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 Smith100200300

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

Thanks! melted.marsbar
melted.marsbar
Member

Posts: 2
Joined: October 10th, 2007, 10:05 am

As a text file, you have to read the entire file, change the line you want, and write the entire data back to file.
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

Ah okay. Well in that case, I shall use an array =) Thanks!
melted.marsbar
Member

Posts: 2
Joined: October 10th, 2007, 10:05 am