Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2004-01-20 11:48:50

Vladimir Prus wrote:

>Consider standard iostream usage

> string s;
> while(getline(is, s)) {
> }

>Here, two cases are possible when getline returns false. First is when eof
>is seen, in which case line is done. Second is when something's really
>wrong with the stream, in which case badbit is set. For serialization

> some_object obj;
> while(ia >> obj) {
> }

>there's possibility that data ended half-way though next object. How can I
>tell if that's the case?

I don't see the difference in the two cases. After each i/o operations good()
is checked. If its false, archive::exception::stream_error is thrown. At
that point the io state is the same can be checked fro badbit, eof or any
thing else.

Robert Ramey

Boost list run by bdawes at, gregod at, cpdaniel at, john at