Updating a file in place 10 rules of dating my son
And then there's Windows (where renames generally don't work when there's open file handles for the file in question, unless all the processes that opened it used an option to allow it).
On Mon, Jun 9, 2014 at AM, ipmcc [email protected]: By analogy: Would it be acceptable if made you save to a different file every time you wanted to save your document?
It was added as an experimental feature on Jul 20, 2014, and removed on Mar 5, 2015.
The original implementation was poor and, in petticoat, had bad semantics.
If it's not a very large archive, it might be better to untar the whole thing and then re-tar it after editing.
Alternately, you could use an uncompressed archive.
Although there are some ways around, you usually can't update an existing file, except sometimes when it has fixed length records (e.g. The solution is usually to write to another file and then replace the old file by the new one, doing the renaming etc.
Or, if your file is not too large, to first read from the file into memory (for example into an array of lines), to make the changes in memory, and to write the memory content onto the file at the end (that's essentially what happens when you open a file with a text editor, with MS Word or similar applications).
Some of the refactoring to move I/O from main.c was done with in-place editing in mind, and is necessary to implement sed-style in-place editing.