質問

How can I write filesystem-dependent code in C++? I am writing a user level library that should handle files in different ways depending on certain features in the underlying filesystem, how can I figure that out?

For example, are there any defined preprocessor directives that expose the filesystem?

役に立ちましたか?

解決

On Windows, you can use the GetVolumeInformation function. On Linux and OSX (and BSD!), you can use the statfs function.

他のヒント

I'm not aware of any information that the preprocessor would give you on this.

Something to keep in mind is that you might be in a situation where the OS supports multiple types of filesystems. It's not inconceivable that an application might be accessing multiple filesystems at the same time on the same box.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top