| www.delorie.com/gnu/docs/gdbm/gdbm_4.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Initialize gdbm system. If the file has a size of zero bytes, a file
initialization procedure is performed, setting up the initial structure in the
file.
The procedure for opening a gdbm file is:
GDBM_FILE dbf; dbf = gdbm_open(name, block_size, flags, mode, fatal_func); |
The parameters are:
gdbm does not append any
characters to this name).
block_size is used.
flags is set to GDBM_READER, the user wants to just read the
database and any call to gdbm_store or gdbm_delete will fail.
Many readers can access the database at the same time. If flags is
set to GDBM_WRITER, the user wants both read and write access to the database
and requires exclusive access. If flags is set to GDBM_WRCREAT, the
user wants both read and write access to the database and if the database does
not exist, create a new one. If flags is set to GDBM_NEWDB, the
user want a new database created, regardless of whether one existed, and wants
read and write access to the new database. The following may also be logically
or'd into the database flags: GDBM_SYNC, which causes all database operations
to be synchronized to the disk, and GDBM_NOLOCK, which prevents the library
from performing any locking on the database file. The option GDBM_FAST is
now obsolete, since gdbm defaults to no-sync mode. Any error detected
will cause a return value of NULL and an appropriate value will be in
gdbm_errno (see Variables). If no errors occur, a pointer to the
gdbm file descriptor will be returned.
gdbm to call if it detects a fatal error. The only
parameter of this function is a string. If the value of NULL is provided,
gdbm will use a default function.
The return value, dbf, is the pointer needed by all other functions to
access that gdbm file. If the return is the NULL pointer,
gdbm_open was not successful. The errors can be found in
gdbm_errno for gdbm errors and in errno for file system
errors (for error codes, see gdbm.h).
In all of the following calls, the parameter dbf refers to the pointer
returned from gdbm_open.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |