Вопрос

In Visual Studio, you are provided the option to change the working directory. I understand how to use it, but I do not know how it works.

How does the working directory setting work in relation to the complication of the application?

Это было полезно?

Решение

For example, if a program tries to open a file using relative directories (like e.g. "dir\\file.ext") then that relative directory is from the programs working directory. The working directory doesn't have to be the directory where the program is located, and the working directory can be changed from inside the program with e.g. the SetCurrentDirectory function.

Another example: Lets say you are starting a program from a command prompt window, and you are in the directory C:\some\folder\. The program is located in D:\other\folder\. Since the current directory when you start the program is C:\some\folder\, the programs working directory will be that as well.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top