16,472
社区成员
发帖
与我相关
我的任务
分享
CString temp = _T("C:\\Documents and Settings\\user\\桌面\\sample.txt");
CString str;
int i = 1;
while (i>0)
{
i = temp.Find(_T('\\'));
temp = temp.Mid(i+1);
}
int j = temp.Find(_T('.'));
temp = temp.Mid(0,j);
cout << temp ;
temp = temp.Mid(temp.ReverseFind('\\'),temp.ReverseFind('.')-1);
temp.Mid(temp.ReverseFind('\\'),temp.ReverseFind('.')-1);
CString temp="C:\Documents and Settings\user\桌面\sample.txt";
temp.substr(temp.ReverseFind('\\'), temp.ReverseFind('.'))
TCHAR *pFile = _T("C:\Documents and Settings\user\桌面\sample.txt");
TCHAR szFileName[MAX_PATH] = { 0 };
TCHAR *p = _tcsrchr(pFile, _T('\\'));
if (p && ++p)
{
_tcscpy(szFileName, p);
}