Difference between revisions of "Dbcreatx()"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
Line 12: Line 12:
 
<input parameters>
 
<input parameters>
  
char *dbname; /* Database file descriptor */
+
char *dbname; /* Database file descriptor */
int nofields; /* Number of fields */
+
int nofields; /* Number of fields */
dBFIELD fields; /* Field structure array */
+
dBFIELD fields; /* Field structure array */
char flddes[128][26]; /* Array for field descriptions */
+
char flddes[128][26]; /* Array for field descriptions */
  
 
<output parameters>
 
<output parameters>
Line 40: Line 40:
 
<code lang="c">
 
<code lang="c">
 
#include<dbl.h>
 
#include<dbl.h>
char *dbname; /* Database name to create */
+
char *dbname; /* Database name to create */
int nofields; /* Number of fields */
+
int nofields; /* Number of fields */
dBFIELD fields; /* Field structure array */
+
dBFIELD fields; /* Field structure array */
char flddes[128][26 ]; /* Array for field description */
+
char flddes[128][26 ]; /* Array for field description */
  
 
rc = dbcreatx("test.dbf",7,fields, flddes);
 
rc = dbcreatx("test.dbf",7,fields, flddes);
 
if (rc != success )  {
 
if (rc != success )  {
printf("Error in creating database: %dn", rc);
+
printf("Error in creating database: %d\n", rc);
 
exit(1);
 
exit(1);
 
}  else {
 
}  else {
printf("Database created.n");
+
printf("Database created.\n");
 
}
 
}
  

Latest revision as of 15:54, 3 April 2009

PURPOSE

create a database, allowing the addition of field descriptions


SYNOPSIS

#include "dbl.h"
 
	int	dbcreatx(dbname, nofields, fields, flddes[128][26])
 
	<input parameters>
 
	char		*dbname;			/* Database file descriptor */
	int		nofields;			/* Number of fields */
	dBFIELD 	fields;			/* Field structure array */
	char		flddes[128][26];		/* Array for field descriptions */
 
	<output parameters>
 
	none


RETURN VALUE

The dbcreatx() function returns 0 upon success. For a description of other possible return error codes, see the return code values section.


DESCRIPTION

The dbcreatx() function performs the same function as The dbcreat() function with the exception that it allows the addition of field descriptions.


EXAMPLE

The following example adds field descriptions stored in the two dimensional array 'flddes[128][26]' to the structure of the database.

#include<dbl.h>
	char		*dbname;			/* Database name to create */
	int		nofields;			/* Number of fields */
	dBFIELD	fields;			/* Field structure array */
	char		flddes[128][26 ];	/* Array for field description */
 
	rc = dbcreatx("test.dbf",7,fields, flddes);
	if (rc != success )  {
		printf("Error in creating database: %d\n", rc);
		exit(1);
	}  else {
		printf("Database created.\n");
	}


SEE ALSO

dbcreat(), dbgetfx()