c语言库有字符串转16进制函数吗(C语言的十六进制)

void HEXtoBCDData(void){,我来为大家科普一下关于c语言库有字符串转16进制函数吗?以下内容希望对你有帮助!

c语言库有字符串转16进制函数吗(C语言的十六进制)

c语言库有字符串转16进制函数吗

void HEXtoBCDData(void)

{

unsigned char ucHEXdata[10] = {0},ucBCDdata[10] = {0};

unsigned int uiHEXdata = 0;

unsigned long int ulHEXdata = 0;

ucHEXdata[0] = 0x63; //十进制为99

ucBCDdata[0] = (ucHEXdata[0]/10)*0x10 (ucHEXdata[0]);

//ucBCDdata[0]=99

ucHEXdata[0] = 0xf5; //十进制为245

ucHEXdata[1] = ucHEXdata[0]/100;

ucHEXdata[2] = ucHEXdata[0]0;

ucBCDdata[0] = ucHEXdata[1];

ucBCDdata[1] = (ucHEXdata[2]/10)*0x10 (ucHEXdata[2]);

//ucBCDdata[1]=2,ucBCDdata[0]=45

uiHEXdata = 0xfff5; //十进制为65525

ucHEXdata[1] = uiHEXdata0;

ucBCDdata[0] = (ucHEXdata[1]/10)*0x10 (ucHEXdata[1]);

uiHEXdata = uiHEXdata/100;

ucHEXdata[2] = uiHEXdata0;

ucBCDdata[1] = (ucHEXdata[2]/10)*0x10 (ucHEXdata[2]);

uiHEXdata = uiHEXdata/100;

ucHEXdata[3] = uiHEXdata0;

ucBCDdata[2] = (ucHEXdata[3]/10)*0x10 (ucHEXdata[3]);

//ucBCDdata[2]=6,ucBCDdata[1]=55,ucBCDdata[0]=25

ulHEXdata = 0xfffffff5; //十进制为4294967285

ucHEXdata[1] = ulHEXdata0;

ucBCDdata[0] = (ucHEXdata[1]/10)*0x10 (ucHEXdata[1]);

ulHEXdata = ulHEXdata/100;

ucHEXdata[2] = ulHEXdata0;

ucBCDdata[1] = (ucHEXdata[2]/10)*0x10 (ucHEXdata[2]);

ulHEXdata = ulHEXdata/100;

ucHEXdata[3] = ulHEXdata0;

ucBCDdata[2] = (ucHEXdata[3]/10)*0x10 (ucHEXdata[3]);

ulHEXdata = ulHEXdata/100;

ucHEXdata[4] = ulHEXdata0;

ucBCDdata[3] = (ucHEXdata[4]/10)*0x10 (ucHEXdata[4]);

ulHEXdata = ulHEXdata/100;

ucHEXdata[5] = ulHEXdata0;

ucBCDdata[4] = (ucHEXdata[5]/10)*0x10 (ucHEXdata[5]);

//ucBCDdata[4]=42,ucBCDdata[3]=94,

//ucBCDdata[2]=96,ucBCDdata[1]=72,ucBCDdata[0]=85

ulHEXdata = 0xfffffff4; //十进制为42 94 96 72 84

for(int i=0;i<5;i )

{

ucHEXdata[i]=ulHEXdata0;

ulHEXdata=ulHEXdata/100;

ucBCDdata[i]=(ucHEXdata[i]/10)*0x10 ucHEXdata[i];

}

//ucBCDdata[4]=42,ucBCDdata[3]=94,

//ucBCDdata[2]=96,ucBCDdata[1]=72,ucBCDdata[0]=84

}

,

免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。文章投诉邮箱:anhduc.ph@yahoo.com

    分享
    投诉
    首页