AMDG Alain Leblanc wrote:
Hi,
Here's the description of the basename() function in the Filesystem library:
template <class Path> typename Path::string_type basename(const Path & p);
Returns: if p.leaf() contains a dot, returns the substring of p.leaf() starting at its beginning and ending at the last dot (the dot is not included). Otherwise, returns p.leaf()
and if I run the following program
==================================================
#include <string> #include <iostream>
#include
namespace bf = boost::filesystem; int main() { string name("/calvin/hobbes/xx.xml"); bf::path filepath(name); cerr << "Value for basename: " << basename(filepath.string().c_str()) << endl; } ==================================================
I get as a result:
Value for basename: xx.xml
I seems like I should be getting 'xx'. Am I not understanding the description, or is there a problem with the library.
I'm surprised that that program even compiles. What version of boost are
you using and what compiler. Does this program work better?
#include <string>
#include <iostream>
#include