Created
July 9, 2018 05:12
-
-
Save lushl9301/4dce0f8d87dece2df3ceb1355fd1869b to your computer and use it in GitHub Desktop.
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 PrintToHex(const char *memory_space, unsigned long offset) { | |
const auto *a = reinterpret_cast<const unsigned char *>(&memory_space); | |
std::cout << std::endl; | |
for (size_t i = 0; i < offset; ++i) { | |
std::cout << std::right << std::setw(2) << std::hex << static_cast<unsigned int>(a[i]) << " "; | |
// std::cout << std::right << std::setw(2) << std::hex << '1' << " "; | |
// std::cout << memory_space[i] << " "; | |
if (i % 10 == 0) { | |
std::cout << std::endl; | |
} | |
} | |
std::cout << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment