Yes, '\0' may appear in the binary format. output->size() will return the
correct result: C++ string can store null characters without any issue.
However, strlen(output->c_str()) and other calls that assume null-terminated
C strings will not.

On Thu, Jun 10, 2010 at 11:30 PM, mistlike <mistl...@gmail.com> wrote:

> bool SerializeToString(string* output) const;: serializes the message
> and stores the bytes in the given string. Note that the bytes are
> binary, not text; we only use the string class as a convenient
> container.
>
>
> string output store binary data, and whether has "\0" in output
> string?
> such as if i want to use output->size() or strlen(output->c_str())
> get its length.
> i see many "\n" in binary data, but not sure it whether has "\0",
> since if has "\0" may have some problem for string to store it.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to proto...@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@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