Dbsize()

From Recital Documentation Wiki
Revision as of 14:43, 1 April 2009 by Yvonnemilne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

PURPOSE

get number of records in a data file


SYNOPSIS

#include "dbl.h"
 
	int	dbsize(dbf, size)
 
	<input parameter>
	char	*dbf;		/* .DBF file descriptor				*/
 
	<output parameter>
	long	size;		/* Address of the variable where the number of records allocated in the .DBF file is returned by the function */


RETURN VALUE

The dbsize() function returns 0 for success, < 0 if an error occurs. See the section on return code values for a detailed list of return codes.


DESCRIPTION

This function returns the number of records currently allocated in the specified .DBF file.


EXAMPLE

This example obtains the number of records existing in the .DBF file whose file descriptor is in "char *dbf" and prints the number on the standard output.

#include "dbl.h"
 
	char	*dbf;		/* .DBF file descriptor	*/
	long	db_size;	/* Size of the .DBF file	*/
	int	rc;		/* Return code			*/
 
	rc = dbsize(dbf, &db_size);
	if (rc = = SUCCESS) {
		printf("the number of records in the database:
			%1d n", db_size);
	} else {
		printf("error number %d n", rc);
		exit (1);
	}


SEE ALSO

dbappend(), dbputr()