next up previous contents index
Next: 9.9 Extended POSIX Support Up: 9.8 Miscellaneous Functions Previous: 9.8.2 ntohs: convert 16-bit

9.8.3 hexdump: print a buffer as a hexdump

   

SYNOPSIS

#include <oskit/c/stdio.h>

void hexdumpb(void *base, void *buf, int nbytes);
void hexdumpw(void *base, void *buf, int nwords);

DESCRIPTION

These functions print out a buffer as a hexdump. For example (the box is included):
.---------------------------------------------------------------------------.
| 00000000       837c240c 00741dc7 05007010 00000000       .|$..t....p..... |
| 00000010       008b4424 0ca30470 10008b04 24a30870       ..D$...p....$..p |
| 00000020       1000eb2c c7050070 10000100 0000833c       ...,...p.......< |
| 00000030       2400740a c7050070 10000200 00008b44       $.t....p.......D |
`---------------------------------------------------------------------------'

The first form treats the buffer as an array of bytes whereas the second treats the buffer as an array of words. This distinction is only important on little-endian machines and only affects the appearance of the four middle columns of hex numbers--the last column of output is identical for both.

PARAMETERS

base
What the first column of output should start at. Passing zero will make the first column show the offset within the buffer rather than an absolute address, which is what happens when base equals buf.
buf
The address of what to dump.
nbytes
How many bytes to dump.
nwords
How many words to dump.



University of Utah Flux Research Group