std::string GetCurrentProcessExeDir(){
char current_proc_path[MAX_PATH] = {0};
::GetModuleFileNameA(NULL, current_proc_path, MAX_PATH);
std::string current_proc_dir;
current_proc_dir.append(current_proc_path);
int separator_pos = current_proc_dir.rfind('\\');
if (std::string::npos == separator_pos)
{
current_proc_dir = "";
}else{
current_proc_dir = current_proc_dir.substr(0, separator_pos);
}
return current_proc_dir;
}
#可执行文件路径# C++如何获取可执行文件目录
最新推荐文章于 2024-07-05 16:42:27 发布