Printf raw data to a fixed length hex output

Viewed 32635

I have a struct, well pointer to a struct, and I wish to printf the first n bytes as a long hex number, or as a string of hex bytes.

Essentially I need the printf equivalent of gdb's examine memory command, x/nxb .

If possible I would like to still use printf as the program's logger function just variant of it. Even better if I can do so without looping through the data.

2 Answers
Related