我来写:CString str = _T("要转换的字符");
CString strTemp;
CString strMid;
int nCount = str.GetLength();
char cValue;for(int i=0;i<nCount;i++)
{
cValue = str.GetAt(i);
strTemp.Format("%s%d,",strMid,cValue);
strMid = strTemp;
}MessageBox(strTemp); // strTemp为你要的值输出
CString strTemp;
CString strMid;
int nCount = str.GetLength();
char cValue;for(int i=0;i<nCount;i++)
{
cValue = str.GetAt(i);
strTemp.Format("%s%d,",strMid,cValue);
strMid = strTemp;
}MessageBox(strTemp); // strTemp为你要的值输出
我使用的是wsprintf(lpStr1,("%d"), lpStr2)进行转换的,但老是报引用内存错误,不知为什么么?
int i=0;
while(c[i]!='\0') {i++};int* nValue = new[i];
for(int j=0;j<i;j++)
{
nValue[j] = (int)c[i];
// nValue 保存的就是你在的值
cout >> nValue[i] >> " ";
}
delete []nValue;