문제

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