文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>C++实现获取当前执行文件全路径

C++实现获取当前执行文件全路径

时间:2010-11-02  来源:Pegasus923

 

#include <Windows.h> 
#include <iostream>       
#include <string> 
using namespace std;    
        
string GetProgramDir()  
{       
        char exeFullPath[MAX_PATH];  // Full path
        string strPath;

        GetModuleFileName(NULL,exeFullPath,MAX_PATH);
        strPath=(string)exeFullPath;
        int pos = strPath.find_last_of('\\', strPath.length());
        return strPath.substr(0, pos);
}       

int main ()
{
        string str = "";

        str = GetProgramDir();
        cout << str << endl;

        return 0;
}

 

 

相关阅读 更多 +
排行榜 更多 +
坦克冒险大师安卓版

坦克冒险大师安卓版

策略塔防 下载
枪战大乱斗2

枪战大乱斗2

飞行射击 下载
猎鸭挑战安卓版

猎鸭挑战安卓版

飞行射击 下载