我怎样才能得到的Unix / Linux / OSX和Windows文件系统的扇区大小? [英] How can I get the filesystem sector size from unix/linux/osx and windows?
问题描述
我希望能够在运行时确定所述扇区大小是对于给文件系统。 C code是可以接受的。例如格式化我的数据分区与具有大量的大型视频文件32K的扇区大小。我希望能够获得在运行时该值。
I want to be able to determine at runtime what the sector size is for a give filesystem. C code is acceptable. for example I format my Data partitions with a 32k sector size that have lots of large video files. I want to be able to get this value at runtime.
推荐答案
我想你想 statvfs (如果页面大小你的意思是扇区大小?)从我记得的作品linux和OSX。我认为你需要使用f_bsize字段,但遗憾的是我没有一个Linux机器来测试针对ATM。
I think you want statvfs (if by pagesize you mean sector size?) which from what I remember works linux and OSX. I think you need to use the f_bsize field but I unfortunately do not have a linux box to test against atm.
有关窗口你想要的 GetDiskFreeSpace 功能。
For windows you want the GetDiskFreeSpace function.
这篇关于我怎样才能得到的Unix / Linux / OSX和Windows文件系统的扇区大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!