[boost.filesystem3] directory name from a directory iterator
Hi: I have the following code to iterate through sub directories: for (boost::filesystem::directory_iterator end, dir(DirectoryToIterate); dir != end; ++dir ) { if (boost::filesystem::is_directory(dir->status())) TempVec.push_back(boost::filesystem::path(dir->path()).generic_wstring()); } I'm getting the following output which I expect: C:/Documents and Settings/All Users/Application Data/Freedom Scientific/JAWS/12.0/Settings/enu I have two questions: Firstly how do I just obtain the last directory in this case enu (with out any slashes)? And secondly, is there a method of the path object that gives me the path in windows form (i.e with the \ character replacing the / character.) Any help appreciated. Cheers Sean.
Sean Farrow wrote:
Hi:
I have the following code to iterate through sub directories:
for (boost::filesystem::directory_iterator end, dir(DirectoryToIterate); dir != end; ++dir ) {
if (boost::filesystem::is_directory(dir->status()))
TempVec.push_back(boost::filesystem::path(dir->path()).generic_wstring());
}
I’m getting the following output which I expect:
C:/Documents and Settings/All Users/Application Data/Freedom Scientific/JAWS/12.0/Settings/enu
I have two questions:
Firstly how do I just obtain the last directory in this case enu (with out any slashes)?
see: http://www.boost.org/doc/libs/1_45_0/libs/filesystem/v3/doc/reference.html#p... and http://www.boost.org/doc/libs/1_45_0/libs/filesystem/v3/doc/reference.html#P...
And secondly, is there a method of the path object that gives me the path in windows form (i.e with the \ character replacing the / character.)
See: http://www.boost.org/doc/libs/1_45_0/libs/filesystem/v3/doc/reference.html#p... Jeff
participants (2)
-
Jeff Flinn
-
Sean Farrow