unicode码转换汉字显示

来源:互联网 发布:unity3d box collider 编辑:程序博客网 时间:2024/05/16 09:31
#include "stdafx.h"#include "windows.h"char*   UNICODEtoASCII(const   wchar_t*   source) {  DWORD   size   =   WideCharToMultiByte(CP_OEMCP,   NULL,   source,   -1,   NULL,   0,   NULL,   NULL);  char*   dest   =   new   char[size];  WideCharToMultiByte(CP_OEMCP,   NULL,   source,   -1,   dest,   size,   NULL,   NULL);  return   dest; } BYTE test[]={0xD5,0x8B,0x4B,0x6D,0x00};   //大小端模式的原因,在VC下,高位在后面int main(int argc, _TCHAR* argv[]){ printf("0x%X\n",*((DWORD*)test)); printf("%s",UNICODEtoASCII((wchar_t*)test)); getchar(); return 0;} 

0 0