Is there a way to obtain the platform\'s path separator character using Boost.Filesystem? By path separator, I mean /
for Unix and \\
for Windows.
As of version 1.57, Boost now has a better solution, that is just constant char
/ wchar_t
( dependent on different platforms ): boost::filesystem::path::preferred_separator
.
Read http://www.boost.org/doc/libs/release/libs/filesystem/doc/reference.html#Operating-system-examples for more information. There are even more system-dependent features in it.
Simple example:
#include
#include
int main() {
std::cout << boost::filesystem::path::preferred_separator << std::endl;
}