Difference between revisions of "Dbckey()"
From Recital Documentation Wiki
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
(One intermediate revision by one user not shown) | |||
Line 11: | Line 11: | ||
<input parameter> | <input parameter> | ||
− | char *ndx; /* .NDX file descriptor | + | char *ndx; /* .NDX file descriptor */ |
<output parameters> | <output parameters> | ||
Line 39: | Line 39: | ||
char *ndx; /* .NDX file descriptor */ | char *ndx; /* .NDX file descriptor */ | ||
− | int rc; | + | int rc; /* Return code */ |
− | char key[12]; /* Current key buffer */ | + | char key[12]; /* Current key buffer */ |
long recno; /* Record number */ | long recno; /* Record number */ | ||
rc = dbckey(ndx, key, &recno); | rc = dbckey(ndx, key, &recno); | ||
− | if (rc = = SUCCESS) printf("%s %d \n", key, recno); | + | if (rc == SUCCESS) printf("%s %d \n", key, recno); |
else { | else { | ||
printf("error number %d \n", rc); | printf("error number %d \n", rc); |
Latest revision as of 11:29, 1 May 2009
PURPOSE
read current key
SYNOPSIS
#include "dbl.h" int dbckey(ndx, key, recno) <input parameter> char *ndx; /* .NDX file descriptor */ <output parameters> char *key; /* Address of the buffer where current key will be returned */ long *recno; /* Address of the buffer where record number associated with the current key will be returned */
RETURN VALUE
The dbckey() 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 reads the current key and its associated record number from the specified .NDX file.
EXAMPLE
Get the current key and its associated record number from the index file and print the retrieved values on the standard output. The key is assumed to be a character.
#include "dbl.h" char *ndx; /* .NDX file descriptor */ int rc; /* Return code */ char key[12]; /* Current key buffer */ long recno; /* Record number */ rc = dbckey(ndx, key, &recno); if (rc == SUCCESS) printf("%s %d \n", key, recno); else { printf("error number %d \n", rc); exit (1); }
SEE ALSO
dbfwd(), dbgetnr(), dbgetpr(), dbnkey(), dbpkey(), dbrewind()