![]() |
![]()
| ![]() |
![]()
NAMEcdb_find - look up a key in a constant database SYNTAX#include <libowfat/cdb.h>
int cdb_find(struct cdb *c, char *key, size_t
keylen);
DESCRIPTIONcdb_find looks for key. If cdb_find returns 0, the database does not contain that key; stop. If cdb_find returns -1, there was a read error; abort. cdb_datalen returns the length of the data associated with the key. Use it to allocate a pointer p with enough space to hold the data. cdb_datapos returns the position of the data inside the file. Use it as argument to cdb_read to retrieve the data. There may be several records under a single key. You can use cdb_findnext to find the next record under this key. EXAMPLEstatic struct c; if (cdb_find(&c,key,strlen(key)>0) {
SEE ALSOcdb_read(3), cdb_init(3), cdb_free(3), cdbmake(1)
|