16,551
社区成员
发帖
与我相关
我的任务
分享
CString tmp="C:\\XXX\\ZZZ\\YY.txt"; //在C++中\比较特殊 如果表示一个\必须写成\\
tmp.Replace("\\","\\\\");
MessageBox(tmp);
CString csSrc = _T("C:\\XXX\\ZZZ\\YY.txt");
CString csDst;
int x;
for(;;)
{
x = csSrc.Find('\\');
if( x == -1) break;
csDst += csSrc.Left(x+1)+'\\';
csSrc = csSrc.Right(csSrc.GetLength()-x-1);
}
csDst+=csSrc;
CMyDoc *pDoc=GetDocument();
CString reportPath = pDoc -> strPathName;
int lentemp = reportPath.GetLength();
reportPath = reportPath.Left(lentemp-4);
int lenpath = reportPath.GetLength();
for(int i=0; i<lenpath-1; ) {
if(reportpath.GetAt(i) = = ‘\\’) {
reportpath.Insert(i, ‘\\’);
i+=2; }
i++;
}