Dbgetfx()

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

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

PURPOSE

get extended .dbf file information


SYNOPSIS

#include<dbl.h>
 
	int	dbgetfx(dbf, reclen, month, day, year, nofields, fields, fldpos, flddes)
 
	<input parameter>
	char		*dbf;				/* Address of the .DBF file descriptor */
 
	<output parameters>
	int		reclen;			/* Record length in bytes */
	char		*month;			/* File creation/update month */
	char		*day;			/* File creation/update day */
	char		*year;			/* File creation/update year */
	int		*nofields;			/* Number of fields in a record */
	dBFIELD	*fields;			/* Array of record fields */
	int		*fldpos;			/* Array of offsets where each field commences */
	char		flddes[128][26];		/* Array to hold field descriptions of each field */


RETURN VALUE

The dbgetfx() 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 obtains database information such as month, day and year of creation or last update, record length, number of fields per record and definitions for each field. The buffer "fields" must be big enough to hold the maximum number of dBFIELD structures: 128 (maximum number of fields per record). The offset for each field position in the record is placed in the buffer "int *fldpos". The field description for each field is placed into "char flddes[128][26]".


EXAMPLE

This example reads database information from the .dbf file and prints record length, update information and number of fields per record on standard output.

#include "dbl.h"
 
	char		*dbf;				/* .DBF file descriptor */
	int		reclen;			/* Record length */
	char		month, day, year;	/* Date of last update */
	int		nofields;			/* Number of fields per record */
	dBFIELD	fields[128];		/* Fields buffer */
	int		1dpos[128];		/* Fields position buffer */
	char		flddes[128][26];		/* Fields description buffer */
	int		rc;				/* Return code */
 
	rc = dbgetf (dbf, &reclen, &month, &day, &year,
		&nofields, fields, fldpos, flddes);
	if (rc = = SUCCESS) {
		printf("reclen=%d month=%d day=%d year=%d,
			nofields=%d n",reclen, month, day, year,
				nofields);
	} else{
		printf("error number %dn", rc);
		exit (1);
	}


SEE ALSO

dbcreat(), dbcreatx(), dbgetf(), dbrecin(), dbrecout()