atoi() from hex representation string

混江龙づ霸主 提交于 2019-11-27 17:14:14

问题


Need to make int from hex representation string like "0xFA" or better "FA". Need something like atoi("FA"). Is there are any standard solutions for that?


回答1:


Try to use strtol():

strtol("FA", NULL, 16);


来源:https://stackoverflow.com/questions/20654424/atoi-from-hex-representation-string

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!