Same here. Trying to cross-compile caffe which uses protobuf, and 
caffe::ReadProtoFromBinaryFile is exactly the code shown above.

I've tried ParseFromCodedStream, ParseFromIstream and ParseFromZeroStream. 
They all returned true (which means success), but the information is not 
complete.

If I first read the content into an array using fread then ParseFromArray, 
everything works well. 

That's really strange.

On Friday, August 21, 2015 at 1:58:47 AM UTC+8, [email protected] wrote:
>
> i make a binary protobuf files in linux and it can well be parse in linux,
>
> int fd = open(filename, O_RDONLY);
>   ZeroCopyInputStream* raw_input = new FileInputStream(fd);
>   CodedInputStream* coded_input = new CodedInputStream(raw_input);
>   coded_input->SetTotalBytesLimit(kProtoReadBytesLimit, 536870912);
>
>
>   bool success = proto->ParseFromCodedStream(coded_input);
>
>
> in windows 
> but after i copy this file to windows, it can be parsed with something but 
> it is not complete, it just has some information,  using mycode to parse.
> but I use protoc.exe to parse it to the text format, it is parsed 
> successfully with complete message.
> if i parse this text format, it can be parse with complete message .
>

-- 
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 https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to