[Shapelib] can't DBFAddField after DBFCloneEmpty

Jeff D. Hamann jeff.hamann at forestinformatics.com
Mon Mar 17 14:50:38 EDT 2008


shapelib'ers:

I have been trying to use the DBFAddField() after calling DBFCloneEmpty() 
with little success. I have been able to generate empty files with new 
fields, but what I need to accomplish to append and populate fields to an 
existing shapefile.

hDBF_Soln = DBFCreate( "results/shapes/test.dbf" );
bid_idx         = DBFAddField( hDBF_Soln, "bid",        FTInteger,  3, 0 );
period_idx      = DBFAddField( hDBF_Soln, "period",     FTInteger,  3, 0 );

works fine:

hDBF_Soln = DBFCloneEmpty( hDBF, "results/shapes/test.dbf" );
period_idx      = DBFAddField( hDBF_Soln, "period",     FTInteger,  3, 0 );

does not. Shouldn't these be the same if the original shapefile only 
contains one field names "bid"?

Any advice would be greatly appreciated.

Thanks,
Jeff.







More information about the Shapelib mailing list