Read / write text file?

  • Thread starter Thread starter Olav Tollefsen
  • Start date Start date
O

Olav Tollefsen

I need to update some lines in a text files. I would like to open the file,
read line by line and change the lines that should be changed and then when
finished the file should have been changed.

I know how to do this if I open one file and write out to a second file, but
how can I do this with a single file without creating a new one?

Olav
 
Without getting into specifics, i'd say something like this:

open a file for RW
read all contents from file
make changes (in memory)
remove all contents from file
write new contents to file
close file
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top