const void* problem
I'd like to use a Comm Port object. It has a Write function, which has two variable inputs. One is a const void*, the other is an int.
The const void* is the variable sent out via a comport, and the int is the length of the characters to send.
My question is: How can I make a const void* from a simple AnsiString?
Should be a simple matter of casting. Something like this:
// do stuff
const void* constVoidString = (const void*)myString;
const void* constVoidString2 = (const void*)myString2.c_str();
You don't have to cast a pointer when assigning to a void*, only when you are going from a void* to a typed pointer
I forgot about the brackets :) It's been awhile since I did things like this :)