c++获取程序目录

来源:互联网 发布:淘宝商场代购 编辑:程序博客网 时间:2024/05/16 19:14
#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;}

0 0
原创粉丝点击