Help!! Casting a Void*
-
Hi Guys, I have a void* Message pointer. i wonder how can i print out the content of the memmory which be pointed by the void type pointer. And is there any article introduce about the void* pointer in detail. Thanks very much in advance!
A void * is a memory address, and you have no idea what is in it. YOu could turn it into a char pointer and thus iterate over the data a byte at a time. But you'll have no idea of it's type, or how long it is. Christian Graus - Microsoft MVP - C++
-
A void * is a memory address, and you have no idea what is in it. YOu could turn it into a char pointer and thus iterate over the data a byte at a time. But you'll have no idea of it's type, or how long it is. Christian Graus - Microsoft MVP - C++
-
Hi Christian, Thanks verymuch for your help! there should be a string stored in side the memory address. Is it possible i can direct cast the it to a string typ? Many thanks
Yes, you can do a
static_cast
or a simple C style cast, just make sure you have valid string at the address, otherwise the thing will blow up at runtime. Regards Senthil _____________________________ My Blog | My Articles | WinMacro