文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
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;
}

 

 

相关阅读 更多 +
排行榜 更多 +
建筑模拟器最新版

建筑模拟器最新版

模拟经营 下载
素人改造师最新版

素人改造师最新版

模拟经营 下载
外星战士幸存者手机版

外星战士幸存者手机版

飞行射击 下载