filesystem::path make_relative( boost::filesystem::path a_From, boost::filesystem::path a_To ) { a_From = boost::filesystem::absolute( a_From ); a_To = boost::filesystem::absolute( a_To ); boost::filesystem::path ret; boost::filesystem::path::const_iterator itrFrom( a_From...
boost::filesystem::relative。 (请参阅此处的文档。) #include <boost/filesystem.hpp> #include <iostream> namespace fs = boost::filesystem; int main() { fs::path parentPath("/home/user1/"); fs::path childPath("/home/user1/Downloads/Books"); fs::path relativePath = fs::relative(chi...