获取路径函数
char* GetCurrentPath() {
char currentPath[MAX_PATH] = { 0 };int n = GetModuleFileNameA(NULL, currentPath, MAX_PATH);
currentPath[strrchr(currentPath, '\\') - currentPath + 1] = 0;//将最后一个"\\"后的字符置为0
return currentPath;
}
拼接路径
char *xmlIR = "config.xml";
char pathIR[1024] = { 0 };
strcpy(pathIR, GetCurrentPath());
strcat(pathIR, xmlIR);