Difference between revisions of "Dbgetnr()"
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
Line 45: | Line 45: | ||
rc = dbgetnr(dbf, ndx, record, &status); | rc = dbgetnr(dbf, ndx, record, &status); | ||
− | if (rc = = SUCCESS) printf("next record read \n"); | + | if (rc == SUCCESS) printf("next record read \n"); |
else { | else { | ||
printf("error number %d \n", rc); | printf("error number %d \n", rc); |
Latest revision as of 12:59, 1 May 2009
PURPOSE
get next data record by key
SYNOPSIS
#include "dbl.h" int dbgetnr(dbf, ndx, record, status) <input parameters> char *dbf; /* .DBF file descriptor */ char *ndx; /* .NDX file descriptor */ <output parameters> char *record; /* Address of the buffer where record is returned */ char status; /* Record status: if record is marked for deletion, status is set to 0 (INACTIVE), otherwise it is set to 1 (ACTIVE) */
RETURN VALUE
The dbgetnr() 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
This function sequentially reads a record in an ascending order. The first record number is obtained by reading the key to record number association table in the .NDX file. Then direct access of the .DBF file by record number is performed. After each sequential read operation, the access pointer to .NDX file is positioned at the next entry in the key to record number association table.
EXAMPLE
This example reads a record and its status from a .DBF file that is indexed one position after the current record.
#include "dbl.h" char *dbf; /* .DBF file descriptor */ char *ndx; /* .NDX file descriptor */ char record[1000]; /* Record buffer */ char status; /* Record status: ACTIVE or INACTIVE */ int rc; /* Return code */ rc = dbgetnr(dbf, ndx, record, &status); if (rc == SUCCESS) printf("next record read \n"); else { printf("error number %d \n", rc); exit (1); }
SEE ALSO
dbckey(), dbdcache(), dbdelete(), dbgetpr(), dbgetr(), dbnkey()