• 您的位置我爱Aspx >> VC.Net >> WindowsCE下Unicode和Ansi字符间互相转换的例子
  • WindowsCE下Unicode和Ansi字符间互相转换的例子

  • 作者:aspxer  来源:internet  日期:2007-5-21 23:49:40  关键字:
  • WC_COMPOSITECHECK | WC_DEFAULTCHAR, //转换出错用缺省字符代替

    tmpstr.GetBuffer(m_snd.GetLength()), //要转换的字符串地址

    m_snd.GetLength(), //要转换的个数

    0, //转换后字符串放置的地址

    0, //最多转换字符的个数,为0表示返回转换Unicode后需要多少个字节

    0, //缺省的字符:"\0"

    0 //缺省的设置

    );

    WideCharToMultiByte( //转换Unicode到Ansi

    CP_ACP,

    WC_COMPOSITECHECK | WC_DEFAULTCHAR,

    tmpstr.GetBuffer(m_snd.GetLength()),

    m_snd.GetLength(),

    (char *)buf, //转换到缓冲区中

    128, //最多128个字节

    0,

    0

    );

    int sendcount=m_psocket->Send(buf,multibytelen+1); //发送转换后的缓冲区

    CString statusstr;

    statusstr.Format(TEXT("共发送字节数:%d"),sendcount);

    m_status.SetWindowText(statusstr); //更新显示栏

    }

    程序接收到的字符串最后保存到CString tmpstr中.

    //接收函数片断

    void MyCeSocket::OnReceive(int nErrorCode)

    {

    // TODO: Add your specialized code here and/or call the base class

    我对这篇文章有话说?
  • 广告位招租,广告代号:content_468_15
  • 上一篇:实战DeviceIoControl 之三:制作磁盘镜像文件
    下一篇:关联自己的应用程序到右键菜单中
  • 相关文章