回答(2)
wustguangh 19级 2015-01-18 10:17:24
CString CXXXXXXApp::GetCurDir()
{
TCHAR sDrive[_MAX_DRIVE];
TCHAR sDir[_MAX_DIR];
TCHAR sFilename[_MAX_FNAME],Filename[_MAX_FNAME];
TCHAR sExt[_MAX_EXT];
GetModuleFileName(AfxGetInstanceHandle(), Filename, _MAX_PATH);
_tsplitpath(Filename, sDrive, sDir, sFilename, sExt);
CString homeDir(CString(sDrive) + CString(sDir));
int nLen = homeDir.GetLength();
if(homeDir.GetAt(nLen-1) != _T(''))
homeDir += _T('');
return homeDir;
}wustguangh 19级 2015-01-18 10:16:56
char pLocalPath[255]; memset(pLocalPath, 0, sizeof(pLocalPath)); GetModuleFileName(AfxGetInstanceHandle(), pLocalPath, sizeof(pLocalPath)); pLocalPath[strrchr(pLocalPath, '\') - pLocalPath] = '


