.TH dbm_store() "" "" "NDBM Function (libgdbm)"
.PC "Store a record into an NDBM data base"
.B "#include <ndbm.h>"
\fBint dbm_store (\fIdatabase\^\fB, \fIkey\^\fB, \fIcontent\^\fB, \fIflags\^\fB)\fR
\fBDBM *\fIdatabase\^\fB;\fR
\fBdatum \fIkey\^\fB, \fIcontent\^\fB;\fR
\fBint \fIflag\^\fB;\fR
.PP
Function
.B dbm_store()
inserts a record into
.IR database ,
which must first have been opened by a call to
.BR dbm_open() .
.I content
points to the data to be stored within the data base; and
.I key
points to the key under which the data are to be stored.
.PP
.I flag
indicates how the the data are to be inserted into the data base.
If it is set to
.BR DBM_INSERT ,
the data are appended onto the data base as new records; in this case,
.B dbm_store()
will not modify existing records that have an identical
.IR key .
If, however, you set
.I flag
to
.BR DBM_REPLACE ,
.I contents
replaces any existing record with an identical
.IR key .
.PP
If all goes well,
.B dbm_store()
returns zero.
It returns a negative value should an error occur.
If you set
.I flag
to
.B DBM_INSERT
and
.B dbm_store()
finds that
.I database
already contains a record with
.IR key ,
it returns one.
.SH "See Also"
.XR "dbm_close()," dbm_close
.XR "dbm_open()," dbm_open
.XR "ndbm.h," ndbm.h
.XR "libgdbm" libgdbm
.SH Notes
For a statement of copyright and permissions on this routine, see the
Lexicon entry for
.BR libdbm .
