Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void print_memory(const void* mem, int size){
- #define BYTES_PER_LINE 16
- const char* ptr = (const char*)mem;
- for ( int i = 0; i < (size + BYTES_PER_LINE - 1) / BYTES_PER_LINE; i++ ){
- printf("%04x|", i * BYTES_PER_LINE);
- for ( int j = 0; j < BYTES_PER_LINE; j++ ){
- int addr = i * BYTES_PER_LINE + j;
- if ( addr < size ){
- printf(" %02x", (int)(unsigned char)ptr[addr]);
- }
- }
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement