[Shapelib] .dbf files
mateusz at loskot.net
Thu Jun 14 12:49:52 EDT 2007
Brian Peschel wrote:
> 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" );
> I believe you need to call DBFClose(DBFHandle psDBF) for the data to
> actually be written to the file.
I gave only essential snippet.
BTW, here is the DBFClose semantic explained:
More information about the Shapelib