0
点赞
收藏
分享

微信扫一扫

C++ 写一段代码获取debug目录的路径

废话不多说,直接上代码
//获取Debug目录路径


TCHAR _szPath[MAX_PATH + 1] = { 0 };

GetModuleFileName(NULL, _szPath, MAX_PATH);

(_tcsrchr(_szPath, _T('\\')))[1] = 0;//删除文件名,只获得路径 字串

CString strPath;

for (int n = 0; _szPath[n]; n++)

{

if (_szPath[n] != _T('\\'))

{

strPath += _szPath[n];

}

else

{

strPath += _T("\\\\");

}

}

AfxMessageBox(strPath);

// m_print.AddString(strPath);

}

举报

相关推荐

0 条评论