Difference between revisions of "Dbpkey()"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 11: Line 11:
  
 
<input parameter>
 
<input parameter>
char *ndx; /* Address of the .NDX file descriptor from which to read a key */
+
char *ndx; /* Address of the .NDX file description from which to read a key */
  
 
<output parameters>
 
<output parameters>
char *key; /* Address of the buffer where the key is stored by the function */
+
char *key; /* Address of the buffer where the key is stored by the function */
 
long *recno; /* Address of the variable where the corresponding record number is stored by the function */
 
long *recno; /* Address of the variable where the corresponding record number is stored by the function */
  

Latest revision as of 14:01, 1 May 2009

PURPOSE

read previous key


SYNOPSIS

#include "dbl.h"
 
	int	dbpkey(ndx, key, recno)
 
	<input parameter>
	char	*ndx;		/* Address of the .NDX file description from which to read a key */
 
	<output parameters>
	char	*key;		/* Address of the buffer where the key is stored by the function */
	long	*recno;		/* Address of the variable where the corresponding record number is stored by the function */


RETURN VALUE

The dbpkey() 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 the previous key in a descending (or counter-alphabetical) order and its associated record number from the .NDX file whose file descriptor is passed to the function.


EXAMPLE

This example reads the previous key and its associated record number from a .NDX file whose file descriptor is in "char *ndx". The key and record number are stored in "char prevkey[18];" and "long recno;" respectively. The key is assumed to be date or numeric.

#include	<dbl.h>
 
	char	*ndx;		/* .NDX file descriptor */
	char	prevkey[8];	/* Key buffer */
	long	recno;		/* Record no. associated with key */
	int	rc;			/* Return code */
 
	rc = dbpkey(ndx, prevkey, &recno);
	else {
		printf("error number %d \n, rc);
		exit (1);
	}


SEE ALSO

dbckey(), dbkeytoa(), dbfwd(), dbgetpr(), dbnkey(), dbrewind()