Dbrewind()

From Recital Documentation Wiki
Jump to: navigation, search

PURPOSE

rewind index file


SYNOPSIS

#include "dbl.h"
 
	int	dbrewind(ndx)
 
	<input parameter>
	char	*ndx;		/* .NDX file descriptor */
 
	<output parameter>
	none


RETURN VALUE

The dbrewind() 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 positions the access pointer at the beginning of the .NDX file. The subsequent dbnkey() locates the first key.


EXAMPLE

This example rewinds the .NDX file whose file descriptor is in "char *ndx" and then reads the first key from the file.


#include "dbl.h"
	char	*ndx;	/* .NDX file descriptor */
	char	key[100];	/* Key buffer */
	long	recnum;	/* Record number */
	int	rc;		/* Return code */
 
	rc = dbrewind(ndx);
	if (rc == SUCCESS){
		rc = dbnkey(ndx, key, recnum);
		if (rc == SUCCESS) printf("key read \n");
		else {
			printf("error number %d \n", rc);
			exit(1);
		}
	}


SEE ALSO

dbckey(), dbfwd(), dbnkey(), dbpkey()