WideCharToMultiByte(...)
看看msdn吧

解决方案 »

  1.   

    BYTE   An 8-bit integer that is not signed.
    所以可用以下函数:atoi, _atoi64  解释:   Convert string to int 
    格式:
       #include <stdlib.h>   int atoi( const char *string );    __int64 _atoi64( const char *string );
      

  2.   

    逆向:
      itoa, _i64toa, _itow, _i64tow   解释: Convert int to string 
    格式:char *_itoa( int value, char *string, int radix );
         参数说明: value   Number to be converted               string  String result              radix     Base of value; must be in the range 2 – 36
      

  3.   

    //第一种 CString To LPBYTE
             CString strTemp="test";
    BYTE* pTemp=(LPBYTE)strTemp.GetBuffer(0);         //第二种 CString To LPBYTE
    CString strTemp2="test2";
    BYTE byTemp[50];
    memcpy(byTemp,strTemp2,strTemp2.GetLength());
    byTemp[strTemp2.GetLength()]='\0';         //第三种 CString To LPBYTE
    CString strTemp3="test3";
    LPBYTE pTemp2=new BYTE[strTemp3.GetLength()];
    memcpy(pTemp2,strTemp3,strTemp3.GetLength());
    pTemp2[strTemp3.GetLength()]='\0';         //...............................................
    //第一种 LPBYTE to CString
    CString strTemp4;
    strTemp4.Format("%s",(LPCSTR)pTemp2);         //第二种 LPBYTE to CString
    CString strTemp5;
    strTemp5=(LPCSTR)pTemp2;以上5种相互转换方式够你用的了。
    Good Luck
      

  4.   

    Thanks DarkPrince
    可惜分都给了。只能在这里表示深深的感谢了。 :)
      

  5.   

    int nLen=m_strDisplay.GetLength();
    char szBuf[1024];正向: BSTR bstr=m_strDisplay.AllocSysString();逆向: int nRet=WideCharToMultiByte(
    CP_ACP, 
    WC_COMPOSITECHECK, 
    bstr, 
    nLen, 
    szBuf, 
    sizeof(szBuf), NULL,NULL);
             szBuf[nRet]='\0';//转换回来时不包括空结束符
      

  6.   

    我想在转换成BYTE后再对每一位进行ASCII码值减128的操作。但是我想如果
    直接用
    Buf[i]=Buf[i]-128;
    那肯定是对地址进行操作了,而不是对值进行操作了。不知道是不是这样,如果是的,
    那应该具体怎么样来做呢?谢谢各位。