Boost logo

Boost Users :

From: Senthil Cheetancheri (scheetancheri_at_[hidden])
Date: 2022-03-18 00:51:56


Hi All,

The current definition of append seems to be identical to that of write. Both are defined as follows:

  1. Create a new file if it doesn't exist.
  2. 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?

Thanks,
Senthil.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net