Line data Source code
1 : /**
2 : * @file
3 : *
4 : * @brief
5 : *
6 : * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
7 : */
8 :
9 : #include <kdb.h>
10 :
11 0 : int main (void)
12 : {
13 0 : KeySet * myConfig = ksNew (0, KS_END);
14 0 : Key * parentKey = keyNew ("/sw/MyApp", KEY_CASCADING_NAME, KEY_END);
15 0 : KDB * handle = kdbOpen (parentKey);
16 :
17 0 : kdbGet (handle, myConfig, parentKey); // kdbGet() must be first
18 : // now any number of any kdbGet()/kdbSet() calls are allowed, e.g.:
19 0 : kdbSet (handle, myConfig, parentKey);
20 :
21 0 : ksDel (myConfig); // delete the in-memory configuration
22 :
23 0 : kdbClose (handle, parentKey); // no more affairs with the key database.
24 0 : keyDel (parentKey); // working with key/ks does not need kdb
25 : }
|