mbstowcsz 转化引起 中文乱码问题

来源:互联网 发布:js和java md5加密解密 编辑:程序博客网 时间:2024/06/06 03:40
用 wtl Cstring 中的转化函数解决 
static int __cdecl _mbstowcsz(wchar_t* wcstr, const char* mbstr, size_t count)
{
 if (count == 0 && wcstr != NULL)
  return 0;
 
 int result = ::MultiByteToWideChar(CP_ACP, 0, mbstr, -1, wcstr, (int)count);
 ATLASSERT(wcstr == NULL || result <= (int)count);
 if (result > 0)
  wcstr[result - 1] = 0;
 return result;
}
原创粉丝点击