Re: [protobuf] Re: a serialization problem, please help, so confused.

2017-06-08 Thread David Zhao
Thank very much. I've found the reason, it's because the serialized data the binary data instead of text, so when stored into a char array, it somehow won't appear textually, but in fact it is there. i'm sorry to have disturbed the forum with such silly question. On Friday, June 9, 2017 at

Re: [protobuf] Re: a serialization problem, please help, so confused.

2017-06-08 Thread 'Bo Yang' via Protocol Buffers
http://www.cplusplus.com/reference/string/string/string/ std::string(buf) will be initialized with null terminated string. If the serialized data contains 0, it will be truncated in the string. I think you should use std::string(buf, n) On Thu, Jun 8, 2017 at 9:57 AM David Zhao