.TH gdbm_store() "" "" "GDBM Function (libgdbm)"
.PC "Add records to a GDBM data base"
.B "#include <gdbm.h>"
\fBint gdbm_store (\fIdatabase\^\fB, \fIkey\^\fB, \fIcontent\^\fB, \fIflag\^\fB)\fR
\fBGDBM_FILE \fIdatabase\^\fB;\fR
\fBdatum \fIkey\^\fB, \fIcontent\^\fB;\fR
\fBint \fIflag\^\fB;\fR
.PP
Function
.B gdbm_store()
writes data into a GDBM data base.
.PP
.I database
points to the data base into which data are written.
It must have been returned by a call to
.BR gdbm_open() .
.PP
.I key
gives the key for the record being written.
.I content
gives the data to be associated with
.IR key .
.PP
.I flag
indicates how data should be written; it can be either of the following:
.IP \fBGDBM_INSERT\fR
Insert only.
If
.I database
already contains a record with
.IR key ,
generate an error.
.IP \fBGDBM_REPLACE\fR
Update.
If
.I database
already contains a record with
.IR key ,
replace it with with
.IR contents .
.PP
If all goes well,
.B gdbm_store()
returns zero.
If
.I database
was opened into read-only mode,
it returns \-1.
If
.I flag
is set to
.B GDBM_INSERT
and
.I database
already contains
.IR key ,
it returns one.
.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 .
