KDK_CONF_GET_VALUE(3)

📦 version 3.0.1.3, in arch rolling, ubuntu resolute, ubuntu stonking

💖 kdk_conf_get_value(3) 💖

okay so bestie, you've landed in section 3 — the Library Functions Manual — and this page is exclusively about one little icon: kdk_conf_get_value. no cap. it does one thing and it does it slayfully. let's get into it 🫶


🌸 NAME 🌸

kdk_conf_get_value — 获取指定配置项的值

translation for the girlies: "get the value of the config item you asked for." that's it. that's the whole job. main character energy, minimal responsibilities ✨


✨ SYNOPSIS ✨

first things first, you gotta pull in the header:

#include <libkyconf.h>

🎀 Functions 🎀

const char* kdk_conf_get_value (int id, const char * group, const char * key)

获取指定配置项的值 — yes she fetches the value of the config entry, that's the function, that's the vibe 💅

🦋 Parameters 🦋

  • id — 由 kdk_conf_init 返回的配置文件句柄 — this is the config-file handle that kdk_conf_init handed you back. it's your lil passport, don't lose it 🎫
  • group — key 所在的组名称 — the name of the group that the key is chillin' inside of 🌸
  • key — 配置项名称 — the name of the config item. the actual thing you're snooping for 👀

💜 Returns 💜

const char* — 配置项所拥有的值,若 key 不存在,则返回一个空字符串

so: it hands you back the value that the config item owns. and if the key doesn't exist? you get an empty string. not NULL. not a crash. just a lil empty string. she's polite like that 😭🫶

don't forget it or the linker will simply not know her 💀


👑 Detailed Description 👑

接口的主要功能是获取指定配置项的值

the main purpose of this interface is to get the value of a specified config item. that's the entire mission statement. no side quests, no lore, just value retrieval. iconic behaviour fr fr ✨


🌈 EXAMPLES 🌈

here's the whole demo, copied exactly how the source page has it — don't come for the formatting, I don't make the rules bestie 🙈

#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: %s0, 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 = %s0, 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_init(), kdk_conf_destroy(), kdk_conf_reload(), kdk_conf_list_key(), kdk_conf_list_group() and kdk_config_freeall().

💀 note the word withdrawn up there. POSIX.1e draft said bye and left the group chat. these ones are still showing up to the party anyway.

🍓 SEE ALSO 🍓

go read her friends, they're all linked up:


💅 Author 💅

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

yeah the author is literally a robot. Doxygen wrote this. she's not a person, she's a documentation generator, and honestly? she ate. 🤖✨


okay that's the whole page bestie, you're officially certified in kdk_conf_get_value(3) 🎓💖

My Project · Fri Sep 22 2023 · KDK_CONF_GET_VALUE(3) — mwah, go forth and fetch those values, you gorgeous nerd 🦋💜
📦 where this page comes from