打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
C++实现获取当前执行文件全路径
#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;    // Get full path of the file
    int pos = strPath.find_last_of('\\', strPath.length());
    return strPath.substr(0, pos);  // Return the directory without the file name
}  
int main ()
{
    string str = "";
    str = GetProgramDir();
    cout << str << endl;
    return 0;
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
C++读取INI文件
C++-实现日志log功能
VBA: 判断某个Excel文件是否已打开
读写 txt aardio
C#获取当前路径的方法 - CookBlack - 博客园
C#笔记(五):文件和流
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服