GetCurrentDirectory获得当前目录

CString strAppName;
GetModuleFileName(NULL, strAppName.GetBuffer(_MAX_PATH), _MAX_PATH);
strAppName.ReleaseBuffer();
int nPos = strAppName.ReverseFind('//');
strAppName = strAppName.Left(nPos + 1);

-----------------------------------------------OR------------------------------------------------------------

TCHAR tchBuffer[MAX_PATH ];

LPTSTR lpszCurDir;

lpszCurDir = tchBuffer;

GetCurrentDirectory(MAX_PATH , lpszCurDir);

MessageBox(lpszCurDir);

你可能感兴趣的:(C++&Other)