Last active
December 15, 2015 13:29
-
-
Save luqmaan/5268070 to your computer and use it in GitHub Desktop.
Dump memory in C++. Be sure to change the type from unsigned char* to whatever is needed. Original at http://stackoverflow.com/questions/1286725/hex-dump-from-memory-location.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Dump( unsigned char* *mem, unsigned int stop ) { | |
cout << "mem = " << mem << endl; | |
unsigned char * p = reinterpret_cast< unsigned char*>( mem ); | |
for ( int i = 0; i < n; i++ ) { | |
std::cout << " " << i << " " << (mem+i) << " " << std::hex << int(p[i]) << std::dec << " " << endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment