19 Jan
2006
19 Jan
'06
5:49 p.m.
Paul Giaccone wrote:
How can you deal with a corrupt file when using filters?
[...]
This works fine if the file is as is required, but if it is corrupted in any way, the program either hangs or crashes.
[...]
How should this be handled? I haven't seen anything about it in the documentation. I imagine I should throw an exception instead of returning 0 (perhaps an iostreams exception?). Given that the crash is the bzip2 (bzip2 being the first operation done when deserialising the file), where would I put the associated catch block?
It's OK, I think I've found what I need in the docs to write an exception: section 3.10 of http://boost.org/libs/iostreams/doc/index.html