#include#include int main() { boost::filesystem::path pathObj("/home/user/Documents/test.txt"); std::cout << pathObj.stem() << std::endl; return 0; }
testIn the above example, we created a Boost.Filesystem path object and passed a file path to it. We then used the function stem() to get the filename without extension and printed it to the console. Package Library: Boost.Filesystem is part of the Boost C++ libraries, which are open-source and available for download at http://www.boost.org.