Really? AFAIK C++ strings handle null's just fine... they're
pascal-style strings, not c-style strings.
$ cat test.cc
#include <string>
#include <iostream>
int main() {
std::string a("a\0b", 3);
std::cout << a.size() << std::endl;
return 0;
}
$ g++ -o test test.cc
$ ./test
3
Or are you saying that the decoder is buggy and somehow doesn't
actually populate the string object correctly?
On Wed, Mar 13, 2013 at 10:37 PM, Sumit Kumar <[email protected]> wrote:
> No you cant, on C++ bytes translates to string, wont allow for null.
>
> Regards,
> Sumit Kumar
>
> On 14 Mar, 2013, at 2:39 AM, Feng Xiao <[email protected]> wrote:
>
> You can just use bytes field.
>
> On Wed, Mar 13, 2013 at 5:38 AM, Giri Guntipalli <[email protected]>
> wrote:
>>
>> we need similar thing to hold binary data in proto message, where i can
>> not use string because binary data may have the null character in middle
>>
>>
>>
>> On Tuesday, 29 January 2013 14:30:31 UTC+5:30, [email protected]
>> wrote:
>>>
>>>
>>> Comment #3 on issue 269 by [email protected]: Would like to have byte
>>> or
>>> int8 type for the message definition
>>> http://code.google.com/p/protobuf/issues/detail?id=269
>>>
>>> Re kumar.sumit:
>>> How are you going to use the byte field to implement a fixed length
>>> string?
>>> If byte can, why can't int32?
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/protobuf?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/protobuf?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/protobuf?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.