Boost logo

Boost Users :

From: Alain Leblanc (aalebl_at_[hidden])
Date: 2008-03-04 21:01:58


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<boost/filesystem/operations.hpp>
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.

a


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net