Re: [protobuf] Store number of messages

2011-03-05 Thread Jason Hsueh
You want WriteLittleEndian* for fixed width numbers. On Sat, Mar 5, 2011 at 7:24 AM, ksamdev wrote: > Hmm, it makes sense now and explains everything. Unfortunately, I didn't > see the way to write fixed width number with CodedOutputStream. Is there a > way to do this? > > -- > You received this

Re: [protobuf] Store number of messages

2011-03-05 Thread ksamdev
Hmm, it makes sense now and explains everything. Unfortunately, I didn't see the way to write fixed width number with CodedOutputStream. Is there a way to do this? -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send

Re: [protobuf] Store number of messages

2011-03-04 Thread Henner Zeller
Varint does an encoding whose length changes with the size of the number - hence the name. So it can use between 1 and 10 bytes. So when the value _events_written changes, re-writing the same number at the beginning of the file will use a different number of bytes. If you want to write a number th

[protobuf] Store number of messages

2011-03-04 Thread ksamdev
I have an application where number of messages is a priory unknown. I can open output file and write 0 in the beginning: Writer::Writer(const string &filename): _output(filename.c_str(), ios::out | ios::trunc | ios::binary), _events_written(0) { _raw_out.reset(new ::google::protobuf: