COHERENT manpages

This page displays the COHERENT manpage for dbm_firstkey() [Retrieve the first key from an NDBM data base].

List of available manpages
Index


dbm_firstkey() -- NDBM Function (libgdbm)

Retrieve the first key from an NDBM data base
#include <ndbm.h>
datum dbm_firstkey (database)
DBM *database;

Function  dbm_firstkey()  retrieves  the  record  with  the  first  key  in
database. database  must first have been opened through  a call to function
dbm_open().

dbm_firstkey()  returns the  address of  the record  it has  retrieved.  It
returns  NULL either  if  something went  wrong  (e.g., it  could not  read
database), or if database is empty.

You  can use  dbm_firstkey() with  function  dbm_nextkey() to  walk through
database. For example:

    for (key = dbm_firstkey(db); key.dptr != NULL; key = dbm_nextkey(db))

See Also


Notes

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