[protobuf] Cannot parse message with CodedInputStream over a pipe

2010-07-30 Thread jetcube
Hi, I've a pipe where i write several pb messages, assuming that their size is kown to be 10766 bytes i wrote this code: IstreamInputStream input(std::cin); CodedInputStream in(input); while(!std:cin.eof()) { CodedInputStream::Limit limit = in.PushLimit(10766); request.Clear();

[protobuf] why ParseFromIstream using std::cin always returns true using a pipe?

2010-07-28 Thread jetcube
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] Re: why ParseFromIstream using std::cin always returns true using a pipe?

2010-07-28 Thread jetcube
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