我来写: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为你要的值输出

解决方案 »

  1.   

    多谢了,不过我是用的WIN32API,不能用MFC类的,
    我使用的是wsprintf(lpStr1,("%d"), lpStr2)进行转换的,但老是报引用内存错误,不知为什么么?
      

  2.   

    先NEW 一把,用完后再DELETE掉
      

  3.   

    api改一下就是了:char c[] = "string name";
    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;