Linux Sync() 等效的 Windows API [英] Linux Sync() equivalent windows API

查看:62
本文介绍了Linux Sync() 等效的 Windows API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Linux"sync()API会将内存中缓冲的所有数据写到磁盘中.Windows中是否有任何等效调用?

Linux "sync( ) API will writes any data buffered in memory out to disk. Is there any equivalent call in Windows?

推荐答案

The FlushFileBuffers function is the equivalent API, although it works more similary to the linux fsync call in the typical use case in that it takes a file handle as a parameter. For sync like behavior you can call FlushFileBuffers with a handle to the volume as described in the documentation I've linked to. This requires the appropriate privileges.

这篇关于Linux Sync() 等效的 Windows API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆