< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index  

Re: [reSIProcate] Printing parameters in ExtensionHeader


What Jason said, except the c_str() is rendundant.

cerr << Data::from(*msg);

david

On 1/21/06, Jason Fischl <jason@xxxxxxxxxxxxxxx> wrote:
> --------------------------------------------------
> char* msg2str(SipMessage* msg){
>
>         resip::Data& DatatoSend = msg->getEncoded();
>         DatatoSend.clear();
>         resip::DataStream encodeStream(DatatoSend);
>         msg->encode(encodeStream);
>         encodeStream.flush();   // pronto per partire
>
>         return (char*)DatatoSend.c_str();
> }

You are returning a pointer to stack memory that is going out of scope
when the function returns. I think what you want is the following
instead.

SipMessage msg;
cerr << Data::from(msg).c_str();

Jason
_______________________________________________
resiprocate-devel mailing list
resiprocate-devel@xxxxxxxxxxxxxxxxxxx
https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel