为什么GetPrivateProfileString函数在调试时,如果最后一个参数是相对路径的话,不能获得正确的值,而在debug或release的exe中跑却是正常的?用绝对路径的话都是正常的。 环境vs2005,win7
迷茫2017-04-17 11:07:25
The reason for environment variables is that the environment variables of the debugger are inherited during debugging. The current directory is the directory specified by the debugger. For example, in VS, it is the project directory, not the directory of the current EXE. But when debug and release are opened directly, the current directory is the directory where the EXE is located
The recommended implementation method is to obtain the path of the current EXE file and concatenate it with the relative path to become an absolute path.