您的位置:首页 > 移动开发

获取当前可执行文件的路径

2010-11-08 09:39 387 查看
使用了cstring

void GetCurrentPath(char *pPath)
{
CString strPath;
//get entire path of running application and its title
GetModuleFileName(NULL,pPath,MAX_PATH);
strPath.Format(pPath);
int iPos=strPath.ReverseFind('//');
if ((unsigned)iPos == -1)
{
return ;
}
memset(pPath, 0, MAX_PATH);
strncpy(pPath, strPath.Left(iPos).GetBuffer(0), iPos);
pPath[iPos]='/0';
}
  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  path application null