#include
int main(void)
{
char *shex = "000f000f";
int idec =0;
int i,mid;
int len = strlen(shex);
printf("%d\n",len);
if(len>8)
return 0;
mid = 0;
idec =0;
for(i =0;i
{
if(shex[i] >='0'&& shex[i]<='9')
mid = shex[i]-'0';
else if(shex[i]>='a'&& shex[i]<='f')
mid= shex[i]-'a'+10;
else if(shex[i]>='A'&&shex[i]<='F')
mid = shex[i]-'A'+10;
else
return 0; //32位一次取得4位 //当i等0时读取的是最高位,所以要右移7*2*2 6*2*2 5*2*2 4*2*2....
mid <<= ((len-i-1)<<2);
idec = idec+mid;
}
printf("%d\n",idec);
fprintf(stdout,"%d",idec);
return 1;
}