The output is correct.  You have not initialized the "header" field.  You
need to call mutable_header() once to initialize it.

On Mon, Nov 16, 2009 at 1:45 AM, edan <edan.sha...@gmail.com> wrote:

>
> I have the following class:
>
>     package PB_SimpleMessage;
>
>     message SimpleMessage
>     {
>       required RootNode header = 1;
>       required RootNode payload = 2;
>     }
>
>     message RootNode
>     {
>       repeated string parameters = 1;
>     }
>
> In my code i am do the following:
>    PB_SimpleMessage::SimpleMessage* pSimpleMsg = new
> PB_SimpleMessage::SimpleMessage;
>    PB_SimpleMessage::RootNode* msgPayload = pSimpleMsg-
> >mutable_payload();
>    string outString;
>    google::protobuf::TextFormat::PrintToString(*pSimpleMsg ,
> &outString);
>    cout << outString << endl;
>
> I believe that the EXPECTED result should be:
> header {
> }
> payload {
> }
>
> However the ACTUAL result is:
> payload {
> }
>
> Can any one tell me why?
> Is It a bug?
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to