Difference between revisions of "Dbfwd()"

From Recital Documentation Wiki
Jump to: navigation, search
Line 36: Line 36:
 
<code lang="c">
 
<code lang="c">
 
#include "dbl.h"
 
#include "dbl.h"
int fd; /* .NDX file descriptor */
+
int fd; /* .NDX file descriptor */
char key[100]; /* Buffer for previous key */
+
char key[100]; /* Buffer for previous key */
long recnum; /* Record number of previous key */
+
long recnum; /* Record number of previous key */
  
 
rc = dbfwd(fd);
 
rc = dbfwd(fd);

Revision as of 10:57, 15 April 2009

PURPOSE

position access pointer at the end of .NDX file


SYNOPSIS

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


RETURN VALUE

The dbfwd() 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 end of the specified .NDX file.


EXAMPLE

This example positions the access pointer at the end of the .NDX file whose file descriptor is in "int fd" and reads the last key from the file.


#include "dbl.h"
	int	fd;		/* .NDX file descriptor */
	char	key[100];	/* Buffer for previous key */
	long	recnum;	/* Record number of previous key */
 
	rc = dbfwd(fd);
	if (rc = = SUCCESS){
		rc = dbpkey(fd, key, &recnum);
		if (rc = = SUCCESS) printf("Last key read \n"):
		else {
			printf("error number %d \n", rc);
			exit (1);
		}
	} else {
		printf("error number %d \n", rc);
		exit (1);
	}


SEE ALSO

dbckey(), dbnkey(), dbpkey(), dbrewind()