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