Difference between revisions of "Dbrmvr()"

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; /* Number of a record to be removed */
+
long recno; /* Number of a record to be removed */
  
 
<output parameters>
 
<output parameters>
Line 39: Line 39:
 
#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 = dbrmvr(dbf, (long) 5002);
 
rc = dbrmvr(dbf, (long) 5002);
if (rc = = SUCCESS) printf("record removed n");
+
if (rc == SUCCESS) printf("record removed \n");
 
else {
 
else {
printf("error number %d n", rc);
+
printf("error number %d \n", rc);
 
exit (1);
 
exit (1);
 
}
 
}

Latest revision as of 14:42, 1 May 2009

PURPOSE

physically remove a record from a data file


SYNOPSIS

#include "dbl.h"
 
	int	dbrmvr(dbf, recno)
 
	<input parameters>
	char	*dbf;		/* .DBF file descriptor */
	long	recno;	/* Number of a record to be removed */
 
	<output parameters>
	none


RETURN VALUE

The dbrmvr() 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 physically removes a record from a .DBF file. All the records whose record numbers are greater than the record number of the deleted record are shifted up. For example, if the 18th record is requested to be deleted, and 20 records currently exist in the database, the 19th and 20th will become 18th and 19th respectively.


EXAMPLE

The following example physically removes the 5002nd record from the data file whose file descriptor is in "char *dbf"

#include "dbl.h"
 
	char	*dbf;		/* .DBF file descriptor */
	int	rc;		/* Return code */
 
	rc = dbrmvr(dbf, (long) 5002);
	if (rc == SUCCESS) printf("record removed \n");
	else {
		printf("error number %d \n", rc);
		exit (1);
	}


SEE ALSO

dbdelete()