字符转换
来源:互联网 发布:node 模块化开发 编辑:程序博客网 时间:2024/06/06 05:29
//ASCI to Unicode
wchar_t* CDrawYUV::AnsiToUnicode(const char* lpcstr){ wchar_t* Pwstr;int i;i = MultiByteToWideChar(CP_ACP,0,lpcstr,-1,NULL,0);Pwstr = new wchar_t[i];MultiByteToWideChar(CP_ACP,0,lpcstr,-1,Pwstr,i);return (Pwstr);}
//UTF8 to unicode
wchar_t * QXUtf82Unicode(const char* utf, size_t *unicode_number){if (!utf || !strlen(utf)){*unicode_number = 0;return NULL;}int dwUnicodeLen = MultiByteToWideChar(CP_UTF8, 0, utf, -1, NULL, 0);size_t num = dwUnicodeLen * sizeof(wchar_t);wchar_t *pwText = (wchar_t*)malloc(num);memset(pwText, 0, num);MultiByteToWideChar(CP_UTF8, 0, utf, -1, pwText, dwUnicodeLen);*unicode_number = dwUnicodeLen - 1;return pwText;}//Unicode to utf8
char* QXUnicode2Utf8(const char* unicode) { int len; len = WideCharToMultiByte(CP_UTF8, 0, (const wchar_t*)unicode, -1, NULL, 0, NULL, NULL); char *szUtf8 = (char*)malloc(len + 1); memset(szUtf8, 0, len + 1); WideCharToMultiByte(CP_UTF8, 0, (const wchar_t*)unicode, -1, szUtf8, len, NULL,NULL); return szUtf8; }
0 0
- 转换字符
- 字符转换
- 字符转换
- 字符转换
- 字符转换
- 字符转换
- 字符转换
- 字符转换
- 字符转换
- 字符转换
- 字符转换
- 字符转换
- 字符转换
- 字符转换
- 字符转换
- 字符转换
- 字符转换
- 字符转换
- 怎样打印sp上的字符串参数呢?
- 搜索算法——总结
- Promise规范
- Android面试题——多线程,同步的实现,wait和sleep的不同
- c++上机第四次实验-【项目3:乘法口诀表】
- 字符转换
- [NOI2005] [BZOJ1500] 维修数列 - splay
- hiho 47 48 拓扑排序
- 拖拽矩形
- php笔记
- 趣味素数-哥德巴赫猜想-java
- Android中处理崩溃异常
- welcome-file-list不起作用
- poj 2355(简单dp)