35 #define TF_HEXDUMP_CC_VERSION \ 38 #include <tfxx/hexdump.h> 44 std::ostream&
hexdump(
const void* pp,
const unsigned int& size,
46 const char& c,
const unsigned int&n)
49 const unsigned char* p=
reinterpret_cast<const unsigned char*
>(pp);
51 unsigned short int ip=0;
53 unsigned short int ic=0;
58 os <<
"size of object: " << size <<
" bytes" << std::endl;
61 std::ostream::fmtflags flags=os.flags();
68 os << std::hex << std::setfill(
'0') << std::setw(4)
69 << std::nouppercase << ip;
72 while ((ip < size) && (ic<n))
76 unsigned short int byte(ch);
79 os << std::hex << std::setfill(
'0') << std::setw(2)
80 << std::nouppercase << byte;
84 if (std::isprint(ch)) { pc[ic]=ch; }
94 for (
unsigned int i=ic; i<n; i++) { os <<
" "; }
97 for (
unsigned int i=0; i<ic; i++) { os << pc[i]; }
std::ostream & hexdump(const void *pp, const unsigned int &size, std::ostream &os, const char &c, const unsigned int &n)
output hex dump of memory area.
Namespace containing all code of library libtfxx.