您的位置:首页 > 其它

多字符串向宽字符的转换(MultiByteToWideChar的示例)

2012-07-20 10:11 519 查看
多字符串向宽字符的转换(MultiByteToWideChar的示例)

char buffer[4096] = {0};

 #ifdef _UNICODE

//返回所需的短字符数组空间的个数

  DWORD dwNum = MultiByteToWideChar (CP_ACP, 0, buffer, -1, NULL, 0);

  wchar_t *pwText;

  pwText = new wchar_t[dwNum];

  if(!pwText)

  {

   delete []pwText;

   return;

  }

  MultiByteToWideChar (CP_ACP, 0, buffer, -1, pwText, dwNum);// 开始转换

  AfxMessageBox(pwText);// 输出

  delete []pwText;  //使用完毕当然要记得释放占用的内存:

#else

  AfxMessageBox(buffer);// 输出

#endif

本文来自:我爱研发网(52RD.com) - R&D大本营

详细出处:http://www.52rd.com/Blog/Detail_RD.Blog_ipgbear_10116.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐