Dbfield()
From Recital Documentation Wiki
PURPOSE
extract the value of a specified field
SYNOPSIS
#include<dbl.h> int dbfield(dbf, record, name, buffer) <input parameter> char *dbf; /* .DBF file descriptor */ char *record; /* Address of the buffer where the record is stored */ char *name; /* The field name */ <output parameters> char *buffer; /* Address of the buffer where the field value is stored as ASCII */
RETURN VALUE
The dbfield() 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.
DESCRIPTION
The dbfield() function extracts the values of the specified field "name" from the given "record" buffer and places the ASCII value in the specified "buffer". The dbgetf() function can be used to obtain the field names for a database.
EXAMPLE
The following example extracts the value from the field "char *name" from the record buffer "char *record" whose file descriptor is in "char *dbf" and stores it in "char *fldvalue" as an ASCII string.
#include "dbl.h" char *dbf; /* .DBF file descriptor */ char record[1000]; /* Record buffer */ char name[10]; /* Name buffer */ char fldvalue[10]; /* Field value */ int rc; /* Return code */ rc = dbfield ( dbf, record, name, fldvalue); if (rc != SUCCESS){ printf("error no %d \n". rc); exit(1); } else printf("Value of field %s is %s\n", name, fldvalue);