What C++ casts is the C cast using in order to convert from a const void* to a unsigned char*?
auto ucharptr = (unsigned char*)const_void_ptr;
Try the C++ casting operator and you need two of them: one to remove the const and another one to cast to your pointer type:
auto ucharptr = reinterpret_cast<unsigned char*>(const_cast<void*>(const_void_ptr));
Try this:
const void* ptr = "test example";
auto ucharptr = static_cast<const unsigned char*>(ptr);
//to remove the const ness
unsigned char* test = const_cast<unsigned char*>(ucharptr);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With