分类:
2008-11-18 15:48:19
How would you use the fsync function () with a standard I/O stream?
answer:
Call fsync after each call to fflush. The argument to fsync is obtained with the fileno function. Calling fsync without calling fflush might do nothing if all the data were still in memory buffers
fflush是将数据从standard i/o 的缓冲写入kernel的缓冲,然后fsync是将kernel的缓冲写入disk.