Dbckey()

From Recital Documentation Wiki
Revision as of 15:46, 3 April 2009 by Yvonnemilne (Talk | contribs)

Jump to: navigation, search

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()