26 lines
No EOL
485 B
Text
26 lines
No EOL
485 B
Text
/*@!Encoding:1252*/
|
|
void bin_to_strhex(byte bin[], char result[])
|
|
{
|
|
char hex_str[17]= "0123456789ABCDEF";
|
|
word i;
|
|
word binsz;
|
|
|
|
binsz = elCount(bin);
|
|
if (binsz > 20)
|
|
binsz = 20;
|
|
|
|
for (i = 0; i < binsz; i++)
|
|
{
|
|
result[i * 3 + 0] = hex_str[bin[i] >> 4 ];
|
|
result[i * 3 + 1] = hex_str[bin[i] & 0x0F];
|
|
result[i * 3 + 2] = ' ';
|
|
}
|
|
|
|
if (elCount(bin) > 20)
|
|
{
|
|
result[56] = '.';
|
|
result[57] = '.';
|
|
result[58] = '.';
|
|
}
|
|
result[binsz * 3 - 1] = 0;
|
|
} |