Difference between revisions of "Dbgetpr()"
From Recital Documentation Wiki
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
Line 11: | Line 11: | ||
<input parameters> | <input parameters> | ||
− | char *ndx; | + | char *ndx; /* .NDX file descriptor */ |
− | char *dbf; /* .DBF file descriptor | + | char *dbf; /* .DBF file descriptor */ |
<output parameters> | <output parameters> | ||
− | char *record; /* User buffer where record contents are returned */ | + | char *record; /* User buffer where record contents are returned */ |
− | char status; | + | char status; /* Status of record: ACTIVE or INACTIVE */ |
</code> | </code> | ||
Line 36: | Line 36: | ||
#include "dbl.h" | #include "dbl.h" | ||
− | char *dbf; /* .DBF file descriptor | + | char *dbf; /* .DBF file descriptor */ |
− | char *ndx; | + | char *ndx; /* .NDX file descriptor */ |
− | char record[1000]; | + | char record[1000]; /* Record buffer */ |
− | char status; | + | char status; /* Record status: ACTIVE or INACTIVE */ |
− | int rc; /* Return code | + | int rc; /* Return code */ |
rc = dbgetpr(dbf, ndx, record, &status); | rc = dbgetpr(dbf, ndx, record, &status); | ||
− | if (rc = = SUCCESS) printf("previous record read n"); | + | if (rc = = SUCCESS) printf("previous record read \n"); |
else { | else { | ||
− | printf("error number %d n", rc); | + | printf("error number %d \n", rc); |
exit (1); | exit (1); | ||
} | } |
Revision as of 10:52, 1 May 2009
PURPOSE
get previous record by key
SYNOPSIS
#include "dbl.h" int dbgetpr(dbf, ndx, record, status) <input parameters> char *ndx; /* .NDX file descriptor */ char *dbf; /* .DBF file descriptor */ <output parameters> char *record; /* User buffer where record contents are returned */ char status; /* Status of record: ACTIVE or INACTIVE */
RETURN VALUE
The dbgetpr() 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 a descending (or counter alphabetical) order. First, the record number is obtained by reading the key to record number association table in the .NDX file. The direct access of .DBF file by record number is then performed. After each sequential read operation, the access pointer to .NDX file is positioned at the previous entry in the key to the record number association table.
EXAMPLE
#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 = dbgetpr(dbf, ndx, record, &status); if (rc = = SUCCESS) printf("previous record read \n"); else { printf("error number %d \n", rc); exit (1); }