KDK_CONF_INIT(3)

NAME
kdk_conf_init - 初始化配置文件

SYNOPSIS

#include <libkyconf.h>

  Functions

  int kdk_conf_init (const char * confpath)

初始化配置文件

Parameters
    confpath 配置文件的路径

Returns
    int 成功返回句柄号（非负值），失败返回错误码（负值）

Link with -lkyconf.

Detailed Description

接口的主要功能是初始化配置文件

EXAMPLES
    #include <libkyconf.h>
    #include <stdio.h>
    #include <string.h>
    int main()
    {
        char **keylist = NULL;
        int id = kdk_conf_init("struct.conf");
        ASSERT_NOT_NULL(id, -1);
        char **grouplist = kdk_conf_list_group(id);
        ASSERT_NOT_NULL(grouplist, -1);
        char *tmpgroup;
        int index = 0;
        while ((tmpgroup = grouplist[index]))
        {
            printf("Group: %s, tmpgroup);
            keylist = kdk_conf_list_key(id, tmpgroup);
            ASSERT_NOT_NULL(keylist, -1);
            char *tmpkey;
            int k_index = 0;
            while ((tmpkey = keylist[k_index]))
            {
                const char *tmpval = kdk_conf_get_value(id, tmpgroup, tmpkey);
                printf("%s = %s, tmpkey , tmpval);
                k_index ++;
            }
            kdk_config_freeall(keylist);
            index ++;
        }
        kdk_conf_destroy(id);
        kdk_config_freeall(grouplist);
        return 0;
    }

CONFORMING TO
These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: kdk_conf_destroy(), kdk_conf_reload(), kdk_conf_get_value(), kdk_conf_list_key(), kdk_conf_list_group() and kdk_config_freeall().

SEE ALSO
kdk_conf_destroy(3), kdk_conf_reload(3), kdk_conf_get_value(3), kdk_conf_list_key(3), kdk_conf_list_group(3) and kdk_config_freeall(3).

Author

Generated automatically by Doxygen for libkyconf.h from the source code.