.TH gdbm_nextkey() "" "" "GDBM Function (libgdbm)"
.PC "Return the next record from a GDBM data base"
.B "#include <gdbm.h>"
\fBdatum gdbm_nextkey(\fIdatabase\^\fB, \fIkey\^\fB)\fR
\fBGDBM_FILE \fIdatabase\^\fB;\fR
\fBdatum \fIkey\^\fB;\fR
.PP
Function
.B gdbm_nextkey()
retrieves the next record from the data base to which
.I database
points.
If
.I database
contains no more records,
it returns a record whose field
.B dptr
is set to NULL.
.PP
.I database
must have been returned by a call to
.BR gdbm_open() .
The call to
.B gdbm_nextkey()
must follow a call to
.BR gdbm_firstkey() .
.PP
Please note that
.B 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
.IR database ,
although the order in which the records are retrieved may not be what you
expect.
.PP
.B gdbm_nextkey()
calls
.B malloc()
to allocate the memory to hold the data it retrieves from
.IR database .
It is your responsibility to free this memory; to do so, call
.B free()
and pass it field
.B dptr
in the record that
.B gdbm_nextkey()
returns.
.SH "See Also"
.XR "gdbm.h," gdbm.h
.XR "gdbm_firstkey()," gdbm_firs
.XR "gdbm_open()," gdbm_open
.XR "libgdbm" libgdbm
.SH Notes
For a statement of copyright and permissions on this routine, see the
Lexicon entry for
.BR libgdbm .
