代码:
int StringToInt(char *hex) { return CharToInt(hex[0]) * 16 + CharToInt(hex[1]); } int CharToInt(char hex) { if (hex>='0' && hex <='9') return hex - '0'; if (hex>='A' && hex <= 'F') return hex-'A'+10; if(hex>='a' && hex <= 'f') return hex-'a'+10; return -1; }
转载于:https://www.cnblogs.com/feipeng8848/p/7595061.html
最后
以上就是超级发箍最近收集整理的关于C语言实现十六进制字符串转数字的全部内容,更多相关C语言实现十六进制字符串转数字内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复