#include <string>
#include <windows.h>
#include <tchar.h>
std::string GetAppPath()
{
//获取应用程序根目录
TCHAR modulePath[MAX_PATH];
GetModuleFileName(NULL, modulePath, MAX_PATH);
std::string strModulePath(modulePath);
strModulePath = strModulePath.assign(strModulePath, 0,
strModulePath.find_last_of(_T('\\')));
return strModulePath;
}
支持中文,支持MinGW,VC
获取应用程序根目录
最新推荐文章于 2023-08-03 10:53:21 发布