I have a problem when using boot library for copying files. After copying a file, sometimes the file size if 0kb.
Here is my code:
boost::filesystem::copy("from.txt", "to.txt");
I just want to know whether should I call sync()
, fsync()
, or fflush()
for that?
As far as I know, only stream based i/o needs fflush()
to guarantee the file writing but, I cannot find the reference documentation about boost::filesystem::copy
.
i found that an answer by myself. boost::filesystem::copy() did not need flush(). but it needs sync() when you want to put them in your flash explicitly.