[gdal-dev] Update existing shape file
Mateusz Loskot
mateusz at loskot.net
Fri Aug 1 10:18:46 EDT 2008
wow wrote:
> Hi,
> I wanna set new field value to an existing shape file which has been
> opened with update access, but it doesn't work, my code like this:
>
> OGRFeature* pFeature = pLayer->GetFeature(2);
> int nIdx = pFeature->GetFieldIndex("Name");
> pFeature->UnsetField(nIdx);
> pFeature->SetField( "Name", "hanJ reiver" );
>
> Anyone give me some advices?
You need to call OGRLayer::SyncToDisk method
http://www.gdal.org/ogr/classOGRLayer.html#ebb07284c734e485d8611b7c8599254f
to get data update flushed to file on disk.
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
More information about the gdal-dev
mailing list