I am using _getcwd() to get the full path of the current working directory but I am having a strange problem with this:
When I run the program from within Visual Studio _getcwd returns "F:\...\ProgramName\bin" to which I append "\Debug\config.txt" to give the path of a text file. However, when I click the exe the program (located in F:\...\ProgramName\bin\Debug) does not work because _getcwd returns "F:\...\ProgramName\bin\Debug". Here's the code I am using
char filepath_config[_MAX_PATH];
_getcwd(filepath_config, _MAX_PATH);
strcat_s(filepath_config, "\\Debug\\config.txt");
ifstream config_in(filepath_config);
Has anyone any idea's why this would happen? I would have expected _getcwd() to return the filepath "F:\...\ProgramName\bin\Debug" always.
Thanks in advance.