[gdal-dev] Error reading from OGR: Unhandled Exception... Access violation reading location 0x00000000

Mateusz Loskot mateusz at loskot.net
Mon Jul 16 02:25:08 PDT 2012


On 16 July 2012 10:10, taibc <taibc_coltech at yahoo.com> wrote:
> I am trying to use OGR classes on VS2010 to read and write from file as the
> link:
> http://gdal.org/ogr/ogr_apitut.html
>
> But I got an error, please see attached screenshot for details.
>
> http://osgeo-org.1560.n6.nabble.com/file/n4988534/error.png

Your pointer poLayer is NULL.
Perhaps the layer you want could not be found by given name
and this call returns NULL:

poLayer = poDS->GetLayerByName(...)

Just check:

if( poLayer == NULL )
{
    printf( "Layer not found.\n" );
    exit( 1 );
}

> Do you know this error ?

http://en.wikipedia.org/wiki/Segmentation_fault#Segmentation.2C_page_fault.2C_and_access_violation

I'd recommend you to get a good C/C++ book.

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the gdal-dev mailing list