2

I am using GDAL 2.1.0 in a C++ application.

I call GDALOpenEx() to open a dataset file. If it fails to open the file, it returns NULL. That is sufficient to bail early. But, I would also like to know what the error was that caused it to fail.

The documentation for GDALOpenEx() ( https://gdal.org/api/raster_c_api.html#gdal_8h_1a9cb8585d0b3c16726b08e25bcc94274a ) says:

If all drivers fail then NULL is returned and an error is issued.

"an error is issued" probably means that it is sent to the callback I register with CPLSetErrorHandler(). I already have such a callback so that the error is logged to my log file. However, is there another way I can get the error immediately after I call GDALOpenEx() ?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.