int2hexsz 整数を16進数列へ変換する
void int2hexsz(char *str, int num);
str (出力)16進数ASCIZ文字列 num (入力)変換したい整数
なし
void int2hexsz(char *str, int num)
{
int i;
static void rint2hexsz();
i = 0;
if (num < 0) {
num = -num;
*str = '-';
i++;
}
rint2hexsz(str, num, &i);
*(str + i) = '\0';
}
static void rint2hexsz(char *str, int num, int *off)
{
int k, n;
if ((k = num >> 4) != 0) rint2hexsz(str, k, off);
n = num & 0xf;
*(str + *off) = n <= 9 ? n + '0' : n - 10 + 'A';
(*off)++;
}