.TH firstkey() "" "" "DBM Function (libgdbm)"
.PC "Retrieve the first record from a DBM data base"
.B "#include <dbm.h>"
\fBdatum firstkey()\fR
.PP
Function
.B firstkey()
retrieves the first record from the currently open DBM data base.
The data base must have been opened by a call to function
.BR dbminit() .
.PP
.B firstkey()
returns a pointer to the retrieved record.
If no record is available (i.e., the data base is empty), or if an error
occurred, field
.B dptr
within the returned record is initialized to NULL.
.PP
Please note that the hashing algorithm used the DBM functions
dictates which record is ``first'' within the data base.
A loop that uses this function plus the function
.B nextkey()
will retrieve every record from the data base; however, the records probably
will not be in the order you expect.
.SH "See Also"
.XR "dbm.h," dbm.h
.XR "libgdbm," libgdbm
.XR "nextkey()" nextkey
.SH Notes
For a statement of copyright and permissions on this routine, see the
Lexicon entry for
.BR libgdbm .
