Search code examples
c++working-directory

Working directory


How do I make the working directory the "debug directory" but not through the properties, but through the code?


Solution

  • chdir ("Debug");
    

    That's what I use for Windows apps.

    Obviously, the directory "Debug" would be inside the current working directory. To go up a level:

    chdir("..");
    

    Or to make a directory:

    mkdir("Debug");
    

    Incidentally, if you need to know where your working directory currently is, use something like:

    char workingDir [_MAX_PATH];
    _getcwd( workingDir, _MAX_PATH );