#define BOOST_FILESYSTEM_VERSION 3 #include #include int main() { char buffer3[255] = "C:\\WINDOWS"; boost::filesystem::path p3(buffer3); p3 /= "SYSTEM32"; for (boost::filesystem::directory_iterator it(p3); it != boost::filesystem::directory_iterator(); it++) { // The paths printed will include extra characters // between "WINDOWS" and "SYSTEM32". std::cout << *it << std::endl; } }