Search code examples
c++xmlopaque-pointers

Obtaining xml data through an opaque pointer


I'm having an issue with retrieving an xml portion of a message using a vendor's api. As an example of what works: getDestination(void* message , void* destination, void* size)

vendordestinationtype_t dest;
getDestination(msg_p, &dest, 16);
printf("Received message. (Destination: %s).\n", dest.dest);

produces: Received message. (Destination: some destination).

Hoever to retrieve the XML portion of the message it requires a function which is getXmlPtr(void* msg, void** xml_ptr, void* xml_length)

char ptr[10000];
int size;
getXmlPtr(msg_p, (void**)&ptr, &size);
printf("Received message. (XML: %s).\n", ptr);

So the question is, how do I declare and pass ptr in such a way that I can get the xml information out (the vendor's documentation is really bad) it mostly says that the argument should be a pointer to the application pointer to fill in with the message XML data pointer on return. The programmer may cast the returned void pointer to any reference suitable for the application.


Solution

  • Well, you declare pointer to void as a pointer to void: void *ptr;.