Dbappend()
PURPOSE
append a record to the end of a database file
SYNOPSIS
#include<dbl.h> int dbappend (dbf, record, recno) <input parameters> char *dbf; char *record; /* Address of a variable where the record number is stored by the function */ <output parameters> long *recno; /* Address of a variable where the record number is stored by the function */
RETURN VALUE
The dbappend() function returns 0 for success, or < 0 if an error occurs. See the section on return code values for a detailed list of return codes.
DESCRIPTIONS
This function writes the contents of the record supplied in a user defined buffer to a .DBF file. The record is appended to the end of the database file and becomes the last physical record in the database. The contents of the output parameter "recno" indicates the record number of the new record.
dbappend() attempts to lock the database to perform the append operation. Therefore appropriate error trapping should be considered.
EXAMPLE
This example appends the record whose contents are in the "char record[100];" to the .DBF file whose file descriptor is in "char *dbf;".
#include "dbl.h" long recno; /* Record number */ char *dbf; /* .DBF file description */ char record[1000]; /* Record buffer */ int rc; /* Return code */ rc = dbappend(dbf, record, &recno); if (rc == SUCCESS) printf("Record added \n"); else { printf("error number %d \n", rc); exit (1); }
SEE ALSO
dbflush(), dbgetr(), dbputr(), dbputrk(), dbsize(), dbupdr()