Tuesday, August 18, 2009

c++: dump memory

# using namespace std;

void dump (const void *mem, unsigned int n) {
const unsigned char *p = reinterpret_cast< const unsigned char *> (mem);

for (unsigned int i = 0; i < n; i++) {
std::cout << hex << iint(p[i]) << " ";
}

std::cout << std::endl;
}


##
dump (ptr, size);

No comments:

Post a Comment