比如 0x0074cbb1 (7654321) 要分别取出 个位 十位 千位 万位 ......
void LongIntTOAsc(unsigned long int a1,unsigned char *pDes) {
*pDes++ = '0'; *pDes++ = HexToAsc(a1/1000000); a1 = a1%1000000; *pDes++ = HexToAsc(a1/100000); a1 = a1%100000; *pDes++ = HexToAsc(a1/10000); a1 = a1%10000; *pDes++ = HexToAsc(a1/1000); a1 = a1%1000; *pDes++ = HexToAsc(a1/100); a1 = a1%100; *pDes++ = HexToAsc(a1/10); *pDes = HexToAsc(a1%10); } main { unsigned long int k1; unsigned char s1[9]; k1 = 0x0074cbb1 ; LongIntTOAsc(k1,s1); //s1 = "07654321" }
这种算法太占资源了,还有没有更好的算**
|