Ask Your Question

Revision history [back]

Boost C++11 provides a module called filesystem that can be used to resolve the symlinks of a file path. Here's an example:

#include <boost/filesystem.hpp>
#include <iostream>

int main() {
    boost::filesystem::path path("/some/symlink/path");
    path = boost::filesystem::canonical(path);
    std::cout << path << std::endl;
    return 0;
}

In this example, the path "/some/symlink/path" is first converted to a boost::filesystem::path object. Then, the canonical() function is called to resolve any symlinks in the path. Finally, the resolved path is printed to the console.

Note that resolving symlinks may result in a different path than the original one, so it's important to check if the resolved path is the expected one before using it.