// Convert a 32 bit integer into HEX void ToHex(char *str, UINT value) { char tmp[MAX_SIZE]; UINT wp = 0; UINT len, i; // Validate arguments if (str == NULL) { return; } // Set to empty character StrCpy(tmp, 0, ""); // Append from the last digit while (true) { UINT a = (UINT)(value % (UINT)16); value = value / (UINT)16; tmp[wp++] = FourBitToHex(a); if (value == 0) { tmp[wp++] = 0; break; } } // Reverse order len = StrLen(tmp); for (i = 0;i < len;i++) { str[len - i - 1] = tmp[i]; } str[len] = 0; }
// 32 bit 整数を HEX に変換 void ToHex(char *str, UINT value) { char tmp[MAX_SIZE]; UINT wp = 0; UINT len, i; // 引数チェック if (str == NULL) { return; } // 空文字に設定 StrCpy(tmp, 0, ""); // 末尾桁から追加する while (true) { UINT a = (UINT)(value % (UINT)16); value = value / (UINT)16; tmp[wp++] = FourBitToHex(a); if (value == 0) { tmp[wp++] = 0; break; } } // 逆順にする len = StrLen(tmp); for (i = 0;i < len;i++) { str[len - i - 1] = tmp[i]; } str[len] = 0; }