Visual Studio Debugging Path

I have c code.

FILE * fin = fopen("myfile", "rb");
if (fin == NULL)
{
    printf("file myfile does not exist, closing");
    return false;
}

It works on compilation, but not in debugging mode (stepping trough), where it returns false. checking argv [0] is ok, and absolute paths work both ways.

+3
source share
1 answer

When you run the program in the debugger, you need to set the current working directory in the debug settings of the project.

+8
source

Source: https://habr.com/ru/post/1715247/


All Articles