您的位置:首页 > 其它

mfc 得到应用程序的文件路径

2017-01-20 16:39 225 查看
//得到当前路径
/*char buf[100];
GetCurrentDirectory(sizeof(buf),buf);
MessageBox(buf);
HINSTANCE hInst=NULL;
hInst=AfxGetApp()->m_hInstance;
char path_buffer[_MAX_PATH];
GetModuleFileName(hInst,path_buffer,sizeof(path_buffer));//得到exe文件的全路径
//分离路径和文件名。
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
_splitpath( path_buffer, drive, dir, fname, ext );
CString Path;
Path.Format("%s%s",drive,dir);

char path[300];

strcpy(path,drive);
strcat(path,dir);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: