for the most part I work in Python, and as such I have developed a great appreciation for the
repr()
repr
void buffrepr(const char * buff, const int size, char * result, const int resultSize)
sprintf(char*, "%X", b);
you can loop thru (very simply) like this:
void buffrepr(const char * buff, const int size, char * result, const int resultSize)
{
while (size && resultSize)
{
int print_count = snprintf(result, resultSize, "%X", *buff);
resultSize -= print_count;
result += print_count;
--size;
++buff;
if (size && resultSize)
{
int print_count = snprintf(result, resultSize, " ");
resultSize -= print_count;
result += print_count;
}
}
}