Scroll to navigation

ECONF_SETVALUE(3) libeconf Manual ECONF_SETVALUE(3)

NAME

econf_set<type>Value - set a value for a key in a configuration file object

SYNOPSIS

#include <libeconf.h>

econf_err econf_setBoolValue(econf_file *kf, const char *group, const char *key, bool value);

econf_err econf_setDoubleValue(econf_file *kf, const char *group, const char *key, double value);

econf_err econf_setFloatValue(econf_file *kf, const char *group, const char *key, float value);

econf_err econf_setIntValue(econf_file *kf, const char *group, const char *key, int value);

econf_err econf_setInt64Value(econf_file *kf, const char *group, const char *key, int64_t value);

econf_err econf_setUInt64Value(econf_file *kf, const char *group, const char *key, uint64_t value);

econf_err econf_setStringValue(econf_file *kf, const char *group, const char *key, const char *value);

econf_err econf_setValue(econf_file *kf, const char *group, const char *key, const char *value);

DESCRIPTION

These functions set the value of a key in the given configuration file object kf. The key is specified by group and key. If group is NULL, the key is considered to belong to none group.

If the key already exists, its value is updated. If the key or the group does not exist, it is created.

The typed function econf_setBoolValue converts the given value into a string representation before storing it.

RETURN VALUE

Upon successful completion, these functions return ECONF_SUCCESS.

On error, a non-zero error code is returned (see the section called “ERRORS”).

ERRORS

ECONF_NOMEM


Insufficient memory to allocate the new entry or group.

ECONF_FILE_LIST_IS_NULL


Conf file list is NULL.

ECONF_EMPTYKEY


Key is NULL or has empty value.

ECONF_NOKEY


Key not found.

ECONF_WRONG_BOOLEAN_VALUE


Wrong boolean value (1/0 true/false yes/no).

SEE ALSO

libeconf(3), econf_errString(3).

2024-12-13 libeconf