[Shapelib] .dbf files
Mateusz Loskot
mateusz at loskot.net
Thu Jun 14 05:52:33 PDT 2007
Kemp Kernstine wrote:
> How does one write records to a .dbf file for shapefiles. I am able
> to create the .dbf file and write a field to the file using
> DBFcreate() and DBFaddField() from the Shapelib, however there is no
> write record function. Is this a function build into C? Do I need to
> have a field for every record?
Just use one of DBFWrite* function with shape index pointing to
new/next record position, and it will be created automatically
(if it does not exists):
// Calculate index of next (new) record
iRecord = DBFGetRecordCount( hDBF );
// Write value to 1st field and (implicitly) create new record
DBFWriteStringAttribute(hDBF, iRecord, 0, "My data" );
Cheers
--
Mateusz Loskot
http://mateusz.loskot.net
More information about the Shapelib
mailing list