📄 subject_21202.htm
字号:
<p>
序号:21202 发表者:summersnow 发表日期:2002-11-14 17:58:15
<br>主题:如何将UNICODE转化为汉字
<br>内容:我现在在做一个vc的GSM开发的程序,但是当我要将手机中的代码转换为汉字的时候出现了问题,我在用MultiBytetoWideChar函数时候遇到了问题,因为函数的参数我设置的不真确,老也将编码转换不成汉字。希望有知道这方面的人不吝赐教。我的邮箱是summersnowqay@163.com!在此先行致谢!
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:目不识丁 回复日期:2002-11-14 18:28:06
<br>内容:const char *WzStrnCpy(char* mbstr, const wchar_t* wcstr, size_t count)<BR>{<BR> int result = ::WideCharToMultiByte(CP_ACP, 0, wcstr, -1,mbstr, count, NULL, NULL);<BR> if (result > 0)<BR> mbstr[result-1] = 0;<BR> return mbstr;<BR>}<BR><BR>wchar_t *WzStrnCpy(wchar_t* wcstr, const char* mbstr, size_t count)<BR>{<BR> int result = ::MultiByteToWideChar(CP_ACP, 0, mbstr, -1,wcstr, count);<BR> if (result > 0)<BR> wcstr[result-1] = 0;<BR> return wcstr;<BR>}<BR><BR>#define MAX_STRING_LEN 4096<BR>const char *WzStrCpy(char* mbstr, const wchar_t* wcstr)<BR>{<BR> int result = ::WideCharToMultiByte(CP_ACP, 0, wcstr, -1,mbstr, MAX_STRING_LEN, NULL, NULL);<BR> if (result > 0)<BR> mbstr[result-1] = 0;<BR> return mbstr;<BR>}<BR><BR>wchar_t *WzStrCpy(wchar_t* wcstr, const char* mbstr)<BR>{<BR> int result = ::MultiByteToWideChar(CP_ACP, 0, mbstr, -1,wcstr, MAX_STRING_LEN);<BR> if (result > 0)<BR> wcstr[result-1] = 0;<BR> return wcstr;<BR>}<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -