Difference between revisions of "Dbmopen()"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
(One intermediate revision by one user not shown)
Line 11: Line 11:
  
 
<input parameters>
 
<input parameters>
char *dbtname; /* Address of a buffer containing the name of a .DBT file to be opened */
+
char *dbtname; /* Address of a buffer containing the name of a .DBT file to be opened */
  
 
<output parameter>
 
<output parameter>
char *dbt; /* The .DBT file descriptor */
+
char *dbt; /* The .DBT file descriptor */
  
 
</code>
 
</code>
Line 37: Line 37:
 
<code lang="c">
 
<code lang="c">
 
#include "dbl.h"
 
#include "dbl.h"
char *dbt; /* .DBT filw descriptor */
+
char *dbt; /* .DBT file descriptor */
int rc; /* Return code */
+
int rc; /* Return code */
  
 
rc = dbmopen("memo.dbt", &dbt);
 
rc = dbmopen("memo.dbt", &dbt);
if (rc = = SUCCESS) printf("memo opened n");
+
if (rc == SUCCESS) printf("memo opened \n");
 
else {
 
else {
printf("error number %d n", rc);
+
printf("error number %d \n", rc);
 
exit (1);
 
exit (1);
 
}
 
}

Latest revision as of 13:49, 1 May 2009

PURPOSE

open an existing .DBT file


SYNOPSIS

#include "dbl.h"
 
	int	dbmopen(dbtname, dbt)
 
	<input parameters>
	char	*dbtname;		/* Address of a buffer containing the name of a .DBT file to be opened */
 
	<output parameter>
	char	*dbt;			/* The .DBT file descriptor */


RETURN VALUE

The dbmopen() 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 .DBT file whose name is passed to the function. The .DBT file descriptor is returned. A call to the dbmclose() function which closes a .DBT file releases the file descriptor for reuse.


EXAMPLE

This example opens an existing memo file "MEMO.DBT" and returns its file descriptor in "char *dbt".


#include "dbl.h"
	char	*dbt;		/* .DBT file descriptor */
	int	 rc;		/* Return code */
 
	rc = dbmopen("memo.dbt", &dbt);
	if (rc == SUCCESS) printf("memo opened \n");
	else {
		printf("error number %d \n", rc);
		exit (1);
	}


SEE ALSO

dbgetm(), dbmclose(), dbmcreat(), dbopen(), dbputm()