Removing elements from a database
The simplest way to remove elements from a database is the DB->del interface.
The DB->del interface takes four of the same five arguments that the DB->get and DB->put interfaces take. The difference is that there is no need to specify a data item, as the delete operation is only interested in the key that you want to remove.
Here's what the code to call DB->del looks like:
#include <sys/types.h> #include <stdio.h> #include <db.h>
After the DB->del call returns, the entry to which the key fruit refers has been removed from the database.