Frage

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?

War es hilfreich?

Lösung

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

Andere Tipps

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top