Because A_instance.user stored with different type of PB.

Fill A_instance.user with B, C, or D , these are diff PB objects.

ok, i will try the follw method.

Thanks!

Kenton Varda 写道:
> First, change A.user to have the type "bytes" instead of "string".
>
> Then do this:
>
> b.SerializeToString(a.mutable_user());
>
> But why not declare "user" to be of type A instead? Like:
>
> message A {
> required B user = 1;
> }
>
> On Wed, Oct 21, 2009 at 1:11 AM, SuKai <sukai090...@gmail.com 
> <mailto:sukai090...@gmail.com>> wrote:
>
>     Hi All!
>
>     SerializeToString is used for translate PB object to std::string,
>     but i want to use this string assign to another PB object's colum.
>
>     I cannot to do it.
>
>     a.proto
>
>     message A
>     {
>     required string user = 1;
>     }
>
>
>     b.proto
>
>     message B
>     {
>     required int counts = 1;
>     }
>
>
>     So, B.SerializeToString() into A.user.
>
>     why?
>
>

--~--~---------~--~----~------------~-------~--~----~
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