In the case of a path like: "C:/Dir/foo.txt", the base name of the file would be "foo". I used to be able to do it like this:
#include <filesystem>
using namespace std;
using namespace std::tr2::sys;
...
path p("C:/Dir/foo.txt");
auto base = p.basename(); // base will now be "foo"
This worked when I used visual studio 2013. Now in the newer version (2015) it will not compile giving me the error:
Error C2039 'basename': is not a member of 'std::experimental::filesystem::v1::path'
What is the equivalent function, or the way to do what I need in the new compiler?
This now appears to be called stem()
Returns the filename identified by the path stripped of its extension.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With