My messages are stored in a file whose format is <Message Length>
(4Bytes)<Message>(Message Length Bytes).
I read the file sequentially, reading the relevant amount of bytes
every iteration, and provide this char* to the ParseMessageFromArray
I also tried using the ParseMessageFromIstream (and provided the
filestream itself), but got the same results.
On Aug 11, 10:03 pm, Kenton Varda <ken...@google.com> wrote:
> In your C++ code, are you storing the message as a NUL-terminated string
> (i.e. as char*)? Protocol Buffers are arbitrary byte arrays and may contain
> NULs, so this won't work. You must either store the message in a
> std::string or you must keep track of the length of the message separately.
> On Tue, Aug 11, 2009 at 9:01 AM, multijon <multi...@gmail.com> wrote:
> > Hi,
> > I'm seeing a strange behaviour of the protobuf library in the
> > following situation:
> > I have a message which contains an optional field uint32
> > 'uploadLimit'.
> > I have created and serialized a message containing the value 0 in this
> > field.
> > When reading this message in Python and C#, I have the value 0 stored
> > in the field, as expected.
> > When reading this message in C++, however, has_uploadlimit() returns
> > 0, instead of 1. uploadlimit() itself returns also 0, but I'm not sure
> > whether I can count on it, since it is not set.
> > Is this really unexpected? Have I misunderstood the usage of the has_
> > method?
> > Jon
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To post to this group, send email to email@example.com
To unsubscribe from this group, send email to
For more options, visit this group at