Skip to content

Instantly share code, notes, and snippets.

@mstump
Created March 3, 2014 17:04
Show Gist options
  • Save mstump/9329533 to your computer and use it in GitHub Desktop.
Save mstump/9329533 to your computer and use it in GitHub Desktop.
Print the hex value of a char array
void
print_hex(
char* value,
size_t size)
{
for (size_t i = 0; i < size; ++i) {
printf("%02.2x ", (unsigned)(unsigned char) value[i]);
}
}
print_hex(TEST_MESSAGE_ERROR, sizeof(TEST_MESSAGE_ERROR));
std::cout << std::endl;
print_hex(message.buffers.front().base, message.buffers.front().len);
std::cout << std::endl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment