Difference between revisions of "Dbfwd()"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 43: Line 43:
 
if (rc = = SUCCESS){
 
if (rc = = SUCCESS){
 
rc = dbpkey(fd, key, &recnum);
 
rc = dbpkey(fd, key, &recnum);
if (rc = = SUCCESS) printf("Last key read n"):
+
if (rc = = SUCCESS) printf("Last key read \n"):
 
else {
 
else {
printf("error number %d n", rc);
+
printf("error number %d \n", rc);
 
exit (1);
 
exit (1);
 
}
 
}
 
} else {
 
} else {
printf("error number %d n", rc);
+
printf("error number %d \n", rc);
 
exit (1);
 
exit (1);
 
}
 
}

Revision as of 10:56, 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()