m进制转换为n进制
void m2n(unsigned char *dest, unsigned int n, unsigned char *src, unsigned int m)
{unsigned char ch, *p = dest - 1;unsigned int i = 0;if ((NULL == dest) || (NULL == src)){return ;}if ((m < 2 || m > 36) || (n < 2 || n > 36)){return ;} while (*src != '\0') /* m进制字符串src转为10进制数i */{i = i * m + (*src - '0');src++;}while (i) /* 辗转相除得出逆序的n进制表示在dest */{*dest = i % n + '0';i /= n;dest++;}*dest = '\0'; /* 在dest写入结尾符 *//* 逆序字符串 */while (++p < --dest){ch = *dest;*dest = *p;*p = ch;}
}