C++ examples for boost:file system
Getting a filename from a path with Boost
#include <iostream> #include <cstdlib> #include <boost/filesystem/operations.hpp> using namespace std; using namespace boost::filesystem; int main(int argc, char** argv) { try { path p = complete(path("test", native)); cout << p.leaf() << " is a " << (is_directory(p) ? "directory" : "file") << endl; } catch (exception& e) { cerr << e.what() << endl; } return(EXIT_SUCCESS); }