I will try . Instead of string with bytes.
This PBs are RW may be on different language(C++ / Java/ Python). Henner Zeller 写道: > On Wed, Oct 21, 2009 at 01:11, SuKai <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. >> > > What exactly does not work ? What do you try to do and what do you > expect but what happens instead ? > > >> a.proto >> >> message A >> { >> required string user = 1; >> } >> >> >> b.proto >> >> message B >> { >> required int counts = 1; >> } >> >> >> So, B.SerializeToString() into A.user. >> >> why? >> > > a_instance.set_user(b_instance.SerializeToString()); > should work. > > You certainly can store the result of a serialized proto buffer in > some other proto buffers string. You might want to use the type > 'bytes' here though because 'string' will have trouble in languages > (such as Java) in which the content is interpreted as UTF-8. > > -h > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---