直接上代码
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <wchar.h>
#define UTF8_STR_LEN 512
#define GBK_STR_LEN 512
// Convert GBK to UTF8
int ConvertGBK2UTF8(const char* szGBK, char* szUTF8, int nUTF8Size)
{
if (!szGBK || !szUTF8) return 0;
int nWcharCnt = MultiByteToWideChar(C