是否有替代
Windows的fsync? (C建造者)
Fsync需要包含unistd.h,它仅适用于unix系统
谢谢!
从手册页:
fflush() forces a write of all user-space
buffered data for the given output or update stream via the stream’s
underlying write function.
提到的write函数告诉操作系统文件的内容应该是什么.此时,所有更改将在实际提交到磁盘之前保存在文件系统缓存中.
POSIX函数fsync()告诉操作系统将其缓存中的所有更改同步到磁盘.正如其他人所说,你可以在Windows平台上使用FlushFileBuffers.