Difference between revisions of "Dbgetfx()"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
Line 11: Line 11:
  
 
<input parameter>
 
<input parameter>
char *dbf; /* Address of the .DBF file descriptor*/
+
char *dbf; /* Address of the .DBF file descriptor */
  
 
<output parameters>
 
<output parameters>
int reclen; /* Record length in bytes */
+
int reclen; /* Record length in bytes */
char *month; /* File creation/update month */
+
char *month; /* File creation/update month */
char *day; /* File creation/update day */
+
char *day; /* File creation/update day */
char *year; /* File creation/update year */
+
char *year; /* File creation/update year */
int *nofields; /* Number of fields in a record */
+
int *nofields; /* Number of fields in a record */
dBFIELD *fields; /* Array of record fields */
+
dBFIELD *fields; /* Array of record fields */
int *fldpos; /* Array of offsets where each field commences*/
+
int *fldpos; /* Array of offsets where each field commences */
char flddes[128][26]; /* Array to hold field descriptions of each field*/
+
char flddes[128][26]; /* Array to hold field descriptions of each field */
  
 
</code>
 
</code>
Line 43: Line 43:
 
#include "dbl.h"
 
#include "dbl.h"
  
char *dbf; /* .DBF file descriptor */
+
char *dbf; /* .DBF file descriptor */
int reclen; /* Record length */
+
int reclen; /* Record length */
char month, day, year; /* Date of last update */
+
char month, day, year; /* Date of last update */
int nofields; /* Number of fields per record */
+
int nofields; /* Number of fields per record */
dBFIELD fields[128]; /* Fields buffer */
+
dBFIELD fields[128]; /* Fields buffer */
int 1dpos[128]; /* Fields position buffer */
+
int 1dpos[128]; /* Fields position buffer */
char flddes[128][26]; /* Fields description buffer */
+
char flddes[128][26]; /* Fields description buffer */
int rc; /* Return code */
+
int rc; /* Return code */
 
 
 
rc = dbgetf (dbf, &reclen, &month, &day, &year,
 
rc = dbgetf (dbf, &reclen, &month, &day, &year,
Line 62: Line 62:
 
exit (1);
 
exit (1);
 
}
 
}
 +
</code>
  
  
SEE ALSO
+
==SEE ALSO==
  
 
[[dbcreat()]], [[dbcreatx()]], [[dbgetf()]], [[dbrecin()]], [[dbrecout()]]
 
[[dbcreat()]], [[dbcreatx()]], [[dbgetf()]], [[dbrecin()]], [[dbrecout()]]
  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
[[Category:Library]]</code>
+
[[Category:Library]]

Latest revision as of 14:43, 19 June 2009

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()