Boost logo

Boost Users :

Subject: Re: [Boost-users] Standard error handler in gil jpeg_io extension calls exit()
From: Sergey Mitsyn (svm_at_[hidden])
Date: 2010-02-06 02:59:27


Hello Peter,

On 31.01.2010 19:28, Peter Goetz wrote:
> Hi,
>
> I'm using the gil jpeg_io extension
>
> which calls the exit() function. I'd prefer to have an exception and
> handle the exception in my main program rather than in the library.
>
> Is there a way to do that?

While new gil.io is not in boost distribution, you can use io_new
available here:

http://gil-contributions.googlecode.com/svn/trunk/gil_2/boost/gil/extension/io_new/

It can be used like this:

gil::rgb8_image_t img;

try
{
     boost::gil::read_and_convert_image(filePath, img,
         boost::gil::jpeg_tag());
}
catch (std::ios_base::failure&)
{
     // oops
}

-----------
Sergey Mitsyn.


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