The title pretty much says it all, but still to elaborate:
I would have understood if the language would have restricted me from adding new contents to a file (irrespective of position) because it would lead to fragmentation. But what I do not understand is why it is not possible to:
- Erase contents from the last line, similar to backspacing from EOF. [ASCII/BINARY]
- Erase contents from middle portion of file [ASCII/BINARY]
- Replace text in a file with some other text of same size [ASCII]
- Replace data in a file with some other data of same size [Binary]
Does any other language support this?
EDIT: To do this in C++, you need to read the file, perform the modifications on variables, then create a new file. The question was why it is not possible to edit the "original" file instead of creating another file.