十六进制转换为10进制

A23015854 2013-08-30 09:02:40
我已经获取到了一个16进制的CString类型的参数getNum,想转换为整形的10进制a,求大神指点
...全文
238 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
阿先森 2013-11-01
  • 打赏
  • 举报
回复
http://download.csdn.net/detail/allenemo/6487471
zhou1xp 2013-08-30
  • 打赏
  • 举报
回复
如果是str=“0x12”这种格式,自己写函数算吧(str.GetAt(0)-"0")*16+str.GetAt(1)-"0"
hdg3707 2013-08-30
  • 打赏
  • 举报
回复
1.
用strtol函数
2.
拆分字符,比如:
CString str="ab";
int a=atpi(str.GetAt(0))*16+atoi(stt.GetAt(1);
A23015854 2013-08-30
  • 打赏
  • 举报
回复
自己先顶下。。。
Eleven 2013-08-30
  • 打赏
  • 举报
回复
_tcstoul(str, NULL, 16)
呔妖怪来嘛 2013-08-30
  • 打赏
  • 举报
回复
CString st = "20"; int n = strtol(st,NULL,16);
A23015854 2013-08-30
  • 打赏
  • 举报
回复
引用 2 楼 hdg3707 的回复:
1. 用strtol函数 2. 拆分字符,比如: CString str="ab"; int a=atpi(str.GetAt(0))*16+atoi(stt.GetAt(1);
麻烦拆字符说的详细点
A23015854 2013-08-30
  • 打赏
  • 举报
回复
引用 2 楼 hdg3707 的回复:
1. 用strtol函数 2. 拆分字符,比如: CString str="ab"; int a=atpi(str.GetAt(0))*16+atoi(stt.GetAt(1);
麻烦拆字符爽的详细点

3,248

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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