Boost logo

Boost Users :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-09-13 12:43:50


Martin Slater wrote:
> Hi there,
>
>
> Are exceptions the only way to propogate an error out of and
> IOStreams.Device policy? We have a lot of code using this style
>
> std::istream is(file);
>
> if(is) { .... }
>
>
> and would like not to have to change it all over to use ios exceptions
> but I can't see a way to avoid it. Is it possible?

When you use a stream, rather than a streambuf, exceptions are caught
automatically and translated into stream state, unless you set the exception
mask to request that exceptions be propagated. (See
http://www.boost.org/libs/iostreams/doc/index.html?path=3.10)

The only time you have to be prepared to handle exceptions is when you are using
a raw stream buffer.

> thanks
>
> Martin

Jonathan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net