0x10 16进制字符串怎么转成 整数
0x10 16进制字符串怎么转成 整数
日期:2022-04-11 14:35:55 人气:1
其实算法很简单,如果判断字符串为一个十六进制数的字符串(通过if(strstr(str,"0x") || strstr(str,"0X"))来判断),就进行每一位的一次转换。其中需要用到pow(x,y)函数,该函数用来计算x的y次幂的值。
#include <math.h>
int Str2Int(char* str)
{
if(
#include <math.h>
int Str2Int(char* str)
{
if(