質問

I am having trouble with boost copy_file(version 1.40.0) method, I would like to overwrite the destination file completely, but it ends up merging source file and destination file if destination text file has more lines.

copy_file(source, destination, overwrite_if_exists)

I would envision it working totally differently, after this operation I would expect source and destination to be exactly the same.

Is this the way this method supposed to work?

Yes I can rename the destination file, copy the source to destination path and if all goes well, I can delete the destination file, but it shocks me that there is no atomic way of doing this in boost.

役に立ちましたか?

解決

According to an answer in how to perform boost::filesystem copy_file with overwrite , this is a bug of boost, and it is fixed in version 1.46.0

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top