Right, that is it! I think this explanation should be in the
documentation :) (maybe it is but i didn't search hard enough)

Thanks!

On Jul 28, 6:34 pm, Jason Hsueh <jas...@google.com> wrote:
> Messages without any required fields are allowed to have an empty
> serialization, so the library cannot assume that parsing empty input is an
> error. You just need to test cin.eof() separately.
>
> On Wed, Jul 28, 2010 at 7:18 AM, jetcube <pmlo...@gmail.com> wrote:
> > I have a simple app that received data using the stdin and i have this
> > loop:
>
> > for(;;) {
> >        if(!request.ParseFromIstream(&cin)) {
> >                cerr << "Cannot parse pb message." << endl;
> >                return -1;
> >        }
> >        do_something();
> > }
>
> > I wanted to test my app so i serialized a protobuf message to a file
> > and run it like:
>
> > ./a.out < message.ser
>
> > however i would expect some blocking after the parse from istream but
> > instead it is constantly returning true (although there is only 1
> > message in the file) making the do something function to be called
> > over and over when i expected it to be only once.
>
> > What am i doing wrong?
>
> > --
> > 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