COHERENT manpages

This page displays the COHERENT manpage for gdbm_nextkey() [Return the next record from a GDBM data base].

List of available manpages
Index


gdbm_nextkey() -- GDBM Function (libgdbm)

Return the next record from a GDBM data base
#include <gdbm.h>
datum gdbm_nextkey(database, key)
GDBM_FILE database;
datum key;

Function gdbm_nextkey()  retrieves the  next record  from the data  base to
which database points.  If database  contains no more records, it returns a
record whose field dptr is set to NULL.

database must  have been  returned by  a call to  gdbm_open(). The  call to
gdbm_nextkey() must follow a call to gdbm_firstkey().

Please note  that gdbm_nextkey() returns  records in the  order dictated by
the algorithm with  which the GDBM routines hash the  data base's keys.  If
called  within a  loop, it  is guaranteed to  retrieve every  record within
database, although the order in which  the records are retrieved may not be
what you expect.

gdbm_nextkey() calls  malloc() to allocate  the memory to hold  the data it
retrieves from database. It is  your responsibility to free this memory; to
do so, call free() and pass it field dptr in the record that gdbm_nextkey()
returns.

See Also


Notes

For  a statement  of copyright  and  permissions on  this routine,  see the
Lexicon entry for libgdbm.