// 拆分 GlueCountDownDay=7^qi^@^$^
//1
int ---Dlg::GetApplicationPath(TCHAR *Path)
{
TCHAR temp[1024];
TCHAR strPath[1024];
::GetModuleFileName(NULL,temp,1024);
int i;
for(i=1023;temp[i]!='\\';i--)
{
}
wcsncpy_s(strPath,_countof(strPath),temp,i);
wcsncpy_s(Path,1024,strPath,1024);
return 0;
}
//
//2
void ---Dlg::INIRead(CString strkey1,CString strkey2,CString &strReadkey2)
{
CString str1,temp;
TCHAR path[1024];
wchar_t strBuffer[200];
GetApplicationPath(path);
temp.Format(_T("%s\\Program\\---.txt"),path);
::GetPrivateProfileString(strkey1,strkey2,_T(""),strBuffer,200,temp);//
strReadkey2=CString(strBuffer);//设备类型
}
//
//3
INIRead(_T("UploadParam"),_T("GlueCountDownDay"),GlueCountDownDay);
int index[10];
for (int i=0;i<10;i++)
{
index[i]=0;
}
index[0]=GlueCountDownDay.Find(_T("^"),0);
if(index[0]<0)return;
for (int i=0;i<3;i++)
{
index[i+1]=GlueCountDownDay.Find(_T("^"),index[i]+1);
if(index[i+1]<0)
{
return ;
}
}
CString zero,one,two,three;
zero=GlueCountDownDay.Mid(0,index[0]); //zero=7
one=GlueCountDownDay.Mid(index[0]+1,index[1]-index[0]-1); //one=qi
two=GlueCountDownDay.Mid(index[1]+1,index[2]-index[1]-1); //two=@
three=GlueCountDownDay.Mid(index[2]+1,index[3]-index[2]-1); //three=$
//
用特定符号拆分CString
于 2022-11-11 15:03:48 首次发布