If you use write
(and not fwrite
or std::ostream::write
), then there is no process buffering. If there is no system failure, then sooner or later (and generally pretty soon) the data will be written to disk.
If you are really concerned about data integrity, you can either in the O_DSYNC
and O_SYNC
flags to the flags when opening the file. If you do this, it ensures that the data is physically written to disk before returning from write
.
source share