The current definition of
append seems to be identical to that of
write. Both are defined as follows:
- Create a new file if it doesn't exist.
- Truncate to zero bytes, if it exists.
The comment for append
says, "The current file position shall be set to the end of the file prior to each
write." However, if the file is always truncated to zero, implementing the above comment achieves nothing significant.
Shouldn't append simply open an existing file or create a new one for writing and set the file-pointer to the end of the file? This will also obviate the need for append_existing.
Following the same line of reasoning for
write:
The comment says that this mode permits random-access reading and writing for the specified file. However again, if the size is always truncated to zero bytes, random-access reading or writing becomes a moot point.
On the other hand, if write is defined not to truncate (as I expected originally), it will obviate the need for write_existing as well.
Am I misunderstanding these definitions? Is there a sound reason behind the current definitions?