如题,新手求指导!

解决方案 »

  1.   

     CString strFull,CString strHalf;
     const char *pszFull=strFull.GetBuffer(strFull.GetLength());
     int npszFull=strlen(pszFull); char* pszHalf=new char[npszFull+1];
     memset(pszHalf,0,npszFull+1); int iHalf=0,iFull=0;
     for(int iFull=0;iFull<npszFull;)
     {
      if((BYTE)(pszFull[iFull])<128)//半角
      {
      memcpy(pszHalf+iHalf,pszFull+iFull,1);
      iHalf++;
      iFull++;
      }
      else//全角
      {
      BYTE bTemp=BYTE(pszFull[iFull+1]);
      char cTemp=bTemp-128;
      memcpy(pszHalf+iHalf,&cTemp,1);
      iHalf++;
      iFull++;
      iFull++;
      }
     }