MFC实现中文GB2312转为2字节16进制数

x2635340408 2012-03-08 04:06:22
如何实现
...全文
173 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
x2635340408 2012-03-09
  • 打赏
  • 举报
回复
感谢给位大神,尤其一楼
shyrgst 2012-03-09
  • 打赏
  • 举报
回复
把buf强制转换一下,(char *)buf, 就可以了,sprintf的函数声明看一下就知道了、
x2635340408 2012-03-09
  • 打赏
  • 举报
回复

引用楼主 x2635340408 的回复:
如何实现
error C2664: 'sprintf' : cannot convert parameter 1 from 'unsigned char [3]' to 'char *'
Types pointed to are unrelated; conversion requires re……
[/Quote]该如何转换呢?
东莞某某某 2012-03-08
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 x2635340408 的回复:]

引用楼主 x2635340408 的回复:
如何实现
error C2664: 'sprintf' : cannot convert parameter 1 from 'unsigned char [3]' to 'char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-……
[/Quote]

(char*) 强转下呗
sparklxd001 2012-03-08
  • 打赏
  • 举报
回复
unicode是不是可以啊
x2635340408 2012-03-08
  • 打赏
  • 举报
回复
[Quote=引用楼主 x2635340408 的回复:]
如何实现
[/Quote]error C2664: 'sprintf' : cannot convert parameter 1 from 'unsigned char [3]' to 'char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
编译时候提示这个是什么意思?
赵4老师 2012-03-08
  • 打赏
  • 举报
回复
CString Hz="啊";
unsigned char buf[3];
unsigned short *qw;
sprintf(buf,"%s",Hz);
qw=(unsigned short *)buf;
printf("%04x",*qw);//b0a1或a1b0

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧