View Single Post
Re: inserting stuff into a file
Old
  (#2)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: inserting stuff into a file - 29-03-2004

You need to open a temporary file, copy the file modifing the line you want to, close the temporary file, delete the file you originally copied, and rename the temporary file to the same name as the file you just deleted.

An alternative is to read the entire file into memory, change the memory image, then write the entire file back out to disk with the same name as the original file.

botman
  
Reply With Quote