日期:2014-05-20 浏览次数:20748 次
char* g(unsigned int a) { char k[] = "0123456789ABCDEF"; char r[sizeof (a)*2]; int i = 0; while (a != 0) { r[i++] = k[a % 16]; a /= 16; } while (i < 4) { r[i++] = '0'; } char* t = malloc(i + 1); int j = 0; while (j < i) { t[j++] = r[i - 1 - j]; } t[i] = 0; return t; }