protocol buffer say it can contain any arbitrary sequence of bytes. but if my data contain ‘\0’ ,how protocol buffer can encode my whole data from a string variable.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The C++ implementation of protocol buffers returns the byte and string types as
std::string. This structure contains a length function telling you how long the corresponding data is (as well as the data itself.) Thus there is no special significance of embeded\0characters.The setting functions accept a string too, or there are versions that accept a buffer and length.
If you want to set a field you can just do this:
or