关于MultiByteToWideChar的汉字问题
银木头 2007-07-03 10:33:50 我有一段程序
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
void main(void)
{
int i;
char *pmbhello ="H里i";
wchar_t *pwc = (wchar_t *)malloc( sizeof( wchar_t )*10);
printf( "转换为宽字符串:\n" );
i = MultiByteToWideChar( CP_ACP,0, pmbhello,-1,pwc, sizeof( wchar_t )*10 );
printf( "\tCharacters converted: %u\n", i );
wprintf( L" wide character: %s\n\n", pwc );
}
英文显示正常,显示中文乱码,为什么?如何解决