得到文件路径的问题(PathStripToRoot,PathStripPath)
我用
char sBuffer[MAX_PATH];
int i = Zero;
sBuffer[First_Bit] = Zero;
CFileDialog dlg(TRUE, NULL, NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT |OFN_ALLOWMULTISELECT,"All Files(*.*)|*.*||");
dlg.m_ofn.lpstrFile = sBuffer;
dlg.m_ofn.nMaxFile = MAX_PATH;
dlg.DoModal();
CString pathname;
POSITION pos = dlg.GetStartPosition(); // Get target path.
pathname = dlg.GetNextPathName(pos );
这样的方法得到了被选择文件的路径:"E:\ASP\CD\server.asp" (举个例子)
用PathStripPath((LPTSTR)(LPCTSTR)pathname)函数可以得到 "server.asp"
用PathStripToRoot((LPTSTR)(LPCTSTR)pathname)函数可以得到 "E:\"
但我想得到 "E:\ASP\CD" ,就是得到路径,哪位大侠知道应该怎么办?