16,551
社区成员
发帖
与我相关
我的任务
分享
#define LENGTH(s) (sizeof(s) / sizeof(int))
int nArray[]={1,2,3,4,5};
int nSize=LENGTH(nArray);
CString szDes(_T("")),tmp;
for(int i=0;i<nSize;i++)
{
tmp.Format(_T("%d"),nArray[i]);
szDes.Append(tmp);
szDes.Append(_T(","));
}
LPCTSTR lpszSource=_T("1,2,3,4,5,");
int i = 0; // substring index to extract
int des[5];
CString strNameValue; // an individual name, value pair
while (AfxExtractSubString(strNameValue, lpszSource, i,_T(',')))
{
// Prepare to move to the next substring
des[i]=_tstoi(strNameValue);
i++;
}