.TH gdbm_fetch() "" "" "GDBM Function (libgdbm)"
.PC "Retrieve a record from a GDBM data base"
.B "#include <gdbm.h>"
\fBdatum gdbm_fetch (\fIdatabase\^\fB, \fIkey\^\fB)\fR
\fBGDBM_FILE \fIdatabase\^\fB;\fR
\fBdatum \fIkey\^\fB;\fR
.PP
Function
.B gdbm_fetch()
retrieves the record with
.I key
from the database to which
.I database
points.
.I database
must have been returned by a call to
.BR gdbm_open() .
.PP
.B gdbm_fetch()
returns the record that contains
.IR key .
If
.I database
does not contains such a record,
.B gdbm_fetch()
returns a record whose field
.B dptr
is set to NULL.
.PP
.B gdbm_fetch()
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_fetch()
returns.
.SH "See Also"
.XR "gdbm.h," gdbm.h
.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 .
