Difference between revisions of "Dbdelete()"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 12: Line 12:
 
<input parameters>
 
<input parameters>
  
char *dbf; /* .DBF file descriptor */
+
char *dbf; /* .DBF file descriptor */
long recno; /* Record number */
+
long recno; /* Record number */
  
 
<output parameters>
 
<output parameters>
Line 38: Line 38:
 
#include "dbl.h"
 
#include "dbl.h"
  
char *dbf; /* File descriptor */
+
char *dbf; /* File descriptor */
int i; /* Counter */
+
int i; /* Counter */
int rc; /* Return code */
+
int rc; /* Return code */
 
for (i = 0; i < 20 ; ++i) {
 
for (i = 0; i < 20 ; ++i) {
 
rc = dbdelete(dbf, i);
 
rc = dbdelete(dbf, i);
if (rc = = SUCCESS) printf("%d record deleted n", i);
+
if (rc = = SUCCESS) printf("%d record deleted \n", i);
 
else {
 
else {
printf("error number %d n", rc);
+
printf("error number %d \n", rc);
 
exit (1);
 
exit (1);
 
}
 
}

Revision as of 15:58, 3 April 2009

PURPOSE

logically delete a record


SYNOPSIS

#include "dbl.h"
 
	int	dbdelete(dbf, recno)
 
	<input parameters>
 
	char	*dbf;		/* .DBF file descriptor */
	long	recno;	/* Record number */
 
	<output parameters>
	none


RETURN VALUE

The dbdelete() 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 deletes the record logically, i.e., it marks the record deleted while physically the record remains in the .DBF file.


EXAMPLE

This example marks 20 records in a .DBF file whose file descriptor is in "char *dbf" deleted and reports the successful deletion on the standard output.

#include "dbl.h"
 
	char	*dbf;		/* File descriptor */
	int	i;		/* Counter */
	int	rc;		/* Return code */
	for (i = 0; i < 20 ; ++i) {
		rc = dbdelete(dbf, i);
		if (rc = = SUCCESS) printf("%d record deleted \n", i);
		else {
			printf("error number %d \n", rc);
			exit (1);
		}
	}


SEE ALSO

dbflush(), dbgetnr(), dbgetr(), dbgetrk(), dbrecall(), dbrmvkey(), dbrmvr(), dbdo()