69,381
社区成员
发帖
与我相关
我的任务
分享
if ( SystemDirectory(abuffer) == 0 )
return 1;
snprintf( bufTemp, sizeof(bufTemp), "%s\\LoginCtrl.db", abuffer ); //login
memset(abuffer, 0, sizeof(abuffer) );
ilen = WideCharToMultiByte( CP_UTF8, 0, bufTemp, -1, 0, 0, NULL, NULL);
pBuf = (char *)malloc( ilen );
WideCharToMultiByte( CP_UTF8, 0, bufTemp, -1, pBuf, ilen, NULL, NULL)
//unicode(GBK) 编码到 utf8
//pDstData == NULL, 测试长度
static int UnicodeToUTF8(const TCHAR* szUnicode, uint16 uLen, char* pDstData, uint16* uDstLen)
{
int nLen = WideCharToMultiByte(CP_UTF8, 0, szUnicode, uLen, NULL, 0, NULL, NULL);
if(pDstData == NULL || uDstLen == 0)
{
//计算需要的长度
return nLen;
}
return *uDstLen = ::WideCharToMultiByte(CP_UTF8, 0, szUnicode, uLen, pDstData, nLen, NULL, NULL);
}