<div>#include "ogrsf_frmts.h"</div><div><br></div><div>#include <stdio.h></div><div><br></div><div>int main()</div><div>{</div><div> const char *pszDriverName = "ESRI Shapefile";</div><div> OGRSFDriver *poDriver;</div>
<div><br></div><div> OGRRegisterAll();</div><div> OGRDataSource *poDS;</div><div><br></div><div> poDS = OGRSFDriverRegistrar::Open( "point_out.shp", FALSE );</div><div> if( poDS == NULL )</div><div>
{</div><div> cout << "Open failed." << endl;</div><div> </div><div> }</div><div><br></div><div> OGRLayer *poLayer;</div><div><br></div><div> poLayer = poDS->GetLayerByName( "point_out" );</div>
<div><br></div><div> OGRFeature *poFeature;</div><div><br></div><div> poLayer->ResetReading();</div><div><br></div><div> OGRGeometry *OLGeometry;</div><div> char *geom = "POINT(6 10)";</div><div>
<br></div><div> OLGeometry->importFromWkt(&geom);</div><div>}</div><div><br></div><div>if the line OLGeometry->importFromWkt(&geom); is not included it works without segfault</div><div><br></div><div>
here is the code which creates the shapefile </div><div><br></div><div><div>const char *pszDriverName = "ESRI Shapefile";</div><div> OGRSFDriver *poDriver;</div><div><br></div><div> OGRRegisterAll();</div>
<div><br></div><div> poDriver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(</div><div> pszDriverName );</div><div> </div><div> OGRDataSource *poDS;</div><div><br></div><div> poDS = poDriver->CreateDataSource( "point_out.shp", NULL );</div>
<div> </div><div><br></div><div> OGRLayer *poLayer;</div><div><br></div><div> poLayer = poDS->CreateLayer( "point_out", NULL, wkbPoint, NULL );</div><div> OGRDataSource::DestroyDataSource( poDS );</div>
</div><div><br></div><br>-- <br>Rashad<br>