Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Here's a more portable version:
Code:std::string dirname(const std::string & path, const std::string & sep) { std::string dir = path.substr(0, path.find_last_of(sep)); return ((dir != path) ? dir : std::string(".")); }