Say I have 64000 bytes in memory at a certain address. I have a pointer char* pointing to the first byte. How would I convert that area of memory to an array of 64000 bytes?
I would prefer not to make a new copy of the memory area if possible.
Say I have 64000 bytes in memory at a certain address. I have a pointer char* pointing to the first byte. How would I convert that area of memory to an array of 64000 bytes?
I would prefer not to make a new copy of the memory area if possible.
You could create a std::string_view
to look at what's there:
#include <string_view>
auto memview = std::string_view(reinterpret_cast<const char*>(the_pointer), 64000);
for(auto ch : memview) {
std::cout << static_cast<int>(ch) << '\n';
}