windows 计算可用磁盘空间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2835094/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Calculating free disk space
提问by Chris
What is the best method for calculating free disk space using C++ only. My target platform is WinCE but most of the file operations are the same as normal Windows.
仅使用 C++ 计算可用磁盘空间的最佳方法是什么。我的目标平台是 WinCE 但大部分文件操作与普通 Windows 相同。
回答by Martin Beckett
You mean usage as in how much space is left? then try GetDiskFreeSpace()
Or do you mean, number of reads/writes/current files open, speed etc?
您的意思是剩余空间的使用情况?然后尝试GetDiskFreeSpace()
或者你的意思是,读/写/当前文件打开的数量,速度等?
回答by Hans Passant
OpenStore + GetStoreInfo. STOREINFO gets you the used size, BytesPerSector * (NumSectors - FreeSectors).
OpenStore + GetStoreInfo。STOREINFO 为您提供使用的大小,BytesPerSector * (NumSectors - FreeSectors)。