Difference between revisions of "Dbdelete()"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 43: Line 43:
 
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);

Latest revision as of 12:49, 1 May 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()