Difference between revisions of "Dbopen()"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 11: Line 11:
  
 
<input parameter>
 
<input parameter>
char *dbfname; /* Address of a buffer containing the name of a .DBF file to be opened */
+
char *dbfname; /* Address of a buffer containing the name of a .DBF file to be opened */
  
 
<output parameter>
 
<output parameter>
char *dbf; /* The .DBF file descriptor */
+
char *dbf; /* The .DBF file descriptor */
  
 
</code>
 
</code>
Line 36: Line 36:
 
<code lang="c">
 
<code lang="c">
 
#include "dbl.h"
 
#include "dbl.h"
char *dbf; /* .DBF file descriptor */
+
char *dbf; /* .DBF file descriptor */
int rc; /* Return code */
+
int rc; /* Return code */
  
 
rc = dbopen("library.dbf", &dbf);
 
rc = dbopen("library.dbf", &dbf);
if (rc = = SUCCESS) printf("database file open n");
+
if (rc == SUCCESS) printf("database file open \n");
 
else {
 
else {
printf("error number %d n", rc);
+
printf("error number %d \n", rc);
 
exit (1);
 
exit (1);
 
}
 
}

Latest revision as of 13:56, 1 May 2009

PURPOSE

open an existing .DBF file


SYNOPSIS

#include "dbl.h"
 
	int	dbopen(dbfname, dbf)
 
	<input parameter>
	char	*dbfname;		/* Address of a buffer containing the name of a .DBF file to be opened */
 
	<output parameter>
	char	*dbf;			/* The .DBF file descriptor */


RETURN VALUE

The dbopen() 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 opens a .DBF file and returns its file descriptor. A call to the dbclose() function releases the file descriptor for use by some other .DBF file.


EXAMPLE

The following example opens a .DBF file "LIBRARY.DBF" and stores its file descriptor in "char *dbf".


#include "dbl.h"
	char	*dbf;		/* .DBF file descriptor */
	int	rc;		/* Return code */
 
	rc = dbopen("library.dbf", &dbf);
	if (rc == SUCCESS) printf("database file open \n");
	else {
		printf("error number %d \n", rc);
		exit (1);
	}


SEE ALSO

dbclose(), dbfilemode(), dbiopen(), dbmopen(), dbonerror()