我使用下面的代码获取程序路径;CString CTestDirDlg::GetCurrWorkingDir()
{
CString strPath;
TCHAR szFull[_MAX_PATH];
TCHAR szDrive[_MAX_DRIVE];
TCHAR szDir[_MAX_DIR];
::GetModuleFileName(NULL, szFull, sizeof(szFull)/sizeof(TCHAR));
_tsplitpath(szFull, szDrive, szDir, NULL, NULL);
_tcscpy(szFull, szDrive);
_tcscat(szFull, szDir);
strPath = CString(szFull);
return strPath;
}
可以得到程序正确的路径,但我对得到的路径strPath操作却不能得到想要的效果,比如程序得到
strPath = "F:\Program Files\Test\";
我使用CString test = strPath - "Test\\";怎么得不到正确的值?
其实我是想得到当前目录的上级目录