获取当前程序所在路径/目录

char   path_buffer[_MAX_PATH];
 char   drive[_MAX_DRIVE];
 char   dir[_MAX_DIR];
 char   fname[_MAX_FNAME];
 char   ext[_MAX_EXT];
    
 GetModuleFileName(NULL,   path_buffer,   _MAX_PATH);   
 _splitpath(path_buffer,   drive,   dir,   fname,   ext);   
 CString   strDir;   
 strDir   +=   drive;   
 strDir   +=   dir;   
 AfxMessageBox(strDir);

转载于:https://www.cnblogs.com/rogee/archive/2011/02/16/1956210.html

你可能感兴趣的:(获取当前程序所在路径/目录)