James,<br><br>You forgot to call GDALAllRegister() before opening the dataset. Then you will not get a NULL with GDALOpen().<br><a href="http://www.gdal.org/gdal_tutorial.html">http://www.gdal.org/gdal_tutorial.html</a><br>
<br><div class="gmail_quote">On Tue, Jul 13, 2010 at 3:40 PM, James Meyer <span dir="ltr"><<a href="mailto:jamesm@lantic.net">jamesm@lantic.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi<br>
<br>
I am trying to use MEM (In-memory) datasets with GDAL.<br>
However, on trying to close the dataset I get a segmentation fault.<br>
The dataset is created successfully. The handle returned is valid and I am able to read and write to it.<br>
<br>
Am I not supposed to try and close the handle or am I doing something else wrong?<br>
<br>
The code is as follows:<br>
<br>
//************************************************<br>
char filename[255];<br>
int datasize = 100 * 100 * (GDALGetDataTypeSize(GDT_Byte) / 8);<br>
<br>
void* data = malloc(datasize);<br>
sprintf(filename,<br>
"MEM:::DATAPOINTER=%p,PIXELS=%d,LINES=%d,BANDS=%d,DATATYPE=%s",<br>
&data, 100, 100, 1, GDALGetDataTypeName(GDT_Byte));<br>
<br>
<br>
GDALDatasetH dst = GDALOpen(filename,GA_Update);<br>
GDALDataset* dest = (GDALDataset*) dst;<br>
<br>
if (! dest )<br>
{<br>
printf("Failed to open Dataset");<br>
}<br>
GDALClose(dst); //This fails<br>
free(data);<br>
//**************************************************<br>
<br>
Thanks<br>
<br>
James<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br>/tʃaɪθənjə/ /kʊmɑr/ <br>+91-9494447584<br>17.2416N 80.1426E<br>