Print parent path?

Hello,

My question for today is, why can't I print parent path when I run my program in command prompt. If I run my program in my IDE under debug or release the parent path of argv[0] prints fine, but for some reason it doesn't print in command prompt. Could anyone explain this phenomenon and give me a possible solution? Thanks!

1
2
3
4
5
6
7
8
int main (int argc, char* argv[])
{
  path hold;
  path folder;
  hold = argv[0];
  folder = hold.parent_path();
  cout << folder << endl;
}
Last edited on
What is `path`?
It's part of the #include <filesystem> library, using namespace std::tr2::sys;
Topic archived. No new replies allowed.