
13 Sep
2005
13 Sep
'05
5:43 p.m.
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