1

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.

4

2 回答 2

0

好吧,您将指向 void 的指针声明为指向 void: 的指针void *ptr;

于 2012-01-06T14:42:35.500 回答
0

void**表示您通过引用传递指针;据推测,该函数将修改 this 以指向存储 XML 数据的位置。所以你需要一个指针,而不是一个数组:

void * ptr;
int size;
getXMLPtr(msg_p, &ptr, &size);
于 2012-01-06T14:46:11.067 回答