in reply to Best way to edit a file?
I recommend that you keep using your current approach (save as temp, delete original, and put temp in place of original). It's a very robust approach. It insures that you will always have a complete copy of the file, even if an error occurs during the save -- an error such as running out of disk space, etc. I would strongly caution against using any approach that destroys/overwrites/deletes the only copy of the file.