标签:getcwd lag length == als get div bsp strlen
使用_getcwd()
std::string getModulePath() { bool flag = false; std::string myStr; const int iLength = 1024; char ModulePath[iLength] = { 0 }; char* path = nullptr; path = (char*)malloc(iLength * sizeof(char)); path = _getcwd(ModulePath, iLength); if (NULL != path) { int len = strlen(ModulePath); for (int i = len - 1; i > 0; i--) { if (ModulePath[i] == ‘\\‘) { ModulePath[i + 1] = 0; flag = true; break; } } } free(path); if (!flag) { myStr = ""; } myStr = ModulePath; return myStr; }
标签:getcwd lag length == als get div bsp strlen
原文地址:https://www.cnblogs.com/Zoya-/p/12717398.html