宽字符转字符串

来源:互联网 发布:磅房软件 编辑:程序博客网 时间:2024/05/21 17:22

UTF8ORANSI ura = MZTUTF8;
char* wcs2str(wchar_t *wstr ,char str[])
{
 if( MZTUTF8 == ura)
 {
  int iTextLen =::WideCharToMultiByte( CP_UTF8,0,wstr,-1,NULL,0,NULL,NULL );
  ::WideCharToMultiByte(CP_UTF8,0,wstr,-1,str,iTextLen,NULL,NULL );
  return str;
 }
 else
 {
  int iTextLen =::WideCharToMultiByte( CP_ACP,0,wstr,-1,NULL,0,NULL,NULL );
  ::WideCharToMultiByte(CP_ACP,0,wstr,-1,str,iTextLen,NULL,NULL );
  return str;
 }

}

0 0
原创粉丝点击