宽字符转字符串

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;
 }

}

你可能感兴趣的:(编程相关)