I am facing an issue with one variable.

Pls look the below piece of code.

pdata0->u.msmlRequest->u.dialogstart->target.value = (const OSUTF8CHAR*) "conn:[$toTAG]";
plist->append (pdata0, TRUE);
msmlEncReturn = pdu.encode();
msgptr = buffer.getMsgPtr();
return ((std::string)(char*)msgptr);

target.value and of type const unsigned char*.
buffer is of type OSXMLEncodeBuffer.
pdu is the pdu designated while xml binding using xbinder.

Problem:- If I set the target value as shown above everything works fine. At last I can it returns the proper payload.

But when I set it using a variable say C string variable.

pdata0->u.msmlRequest->u.dialogstart->target.value = (const OSUTF8CHAR*) msmlTarget;

This sets the target value. I can get that value printed. but it does not return the proper payload. Instead it returns the junk value!!!

Can anyone help me here?

Last edited on
make sure that you do not return a pointer to a temporary object.
Thanks for the reply! The behaviour remained same even without returning anything.
You didn't provide enough code to tell what's wrong.

But if msmlTarget is a local variable then you must not use it outside the function/scope where it's defined.
Its fixed now. The issue was in type of "target" variable.
It accepts only the string starts from "conn:" or "conf:".
Hence failing for test strings...! It must have been defined in the underneath (xsd generated) code.
Topic archived. No new replies allowed.