[gdal-dev] C++ / GDAL - reading raster, exception, access violation, help please!

Even Rouault even.rouault at spatialys.com
Sat Nov 10 00:33:19 PST 2018


[...]
> 
>        float *inDSRow = (float*)CPLMalloc(sizeof(float)*nCols);
[...]
>              inDS->GetRasterBand(1)->RasterIO(GF_Read, 0, i, nCols, 1,
> inDSRow, nCols, 1, GDT_CFloat32, 0, 0);

The memory allocation and requested datatypes aren't consistent:
- either you really want complex Float32, and then you need 2 floats per 
sample. That is CPLMalloc(2 * sizeof(float) * nCols)
- or you want non-complex Float32, and request GDT_Float32 instead

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list