Skip to content

KvConfigGet

Description

Get stored value for key as a new Str copy.

Parameters

Name Direction Description
cfg in,out Parsed config.
key in Lookup key. Prefer Str *; Zstr accepted.

Success

Newly allocated copy of stored Str value. Caller must StrDeinit(...) it.

Failure

Empty Str if key does not exist.

Usage example (Cross-references)

Usage examples (Cross-references)
    
        stored_host = KvConfigGetPtr(&cfg, "host");
        host_copy   = KvConfigGet(&cfg, "host");
    
        result = result && stored_host;
    
        // get copy via Str*
        Str got = KvConfigGet(&cfg, &k_name);
        result  = result && (StrCmp(&got, "misra") == 0);
        StrDeinit(&got);
Last updated on