问题标签 [libconfig]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
110 浏览

javascript - 如何在javascript中解析libconfig生成的配置文件

一些应用程序使用https://github.com/hyperrealm/libconfig来生成配置文件。我想知道是否有任何包装器或库或任何一般方式可以从磁盘parse/write这种配置文件但使用javascript。

我的文件看起来像:

0 投票
1 回答
245 浏览

c++ - 无法找到/读取配置文件 .conf - FileIOException

我正在尝试使用libconfig::readFile()在我的程序中打开和读取 .conf 文件,但它总是给我一个 FileIOException。我认为该程序无法找到该文件,但我不知道问题出在哪里。

这是 .conf 文件代码:

这是我试图打开文件并阅读它的地方:

提前感谢任何类型的帮助。

0 投票
0 回答
24 浏览

c - 为什么调用 libconfig 的 config_lookup 函数会结束程序?

我正在使用 Mark Lindner 制作的非常好的 libconfig 库。它作为 Red Hat 安装的一部分提供。

有时,当我打电话时config_lookup,电话不回。大多数时候确实如此。

相反,进程停止运行,我们的看门狗脚本注意到它已停止运行并重新启动它。

输出和代码如下。这是 config_lookup 的已知行为吗?

0 投票
0 回答
352 浏览

cmake - 没有找到所需的“libconfig++”

我在 RHEL8 容器中构建了 libconfig 依赖项,但 cmake 无法检测到它。

我可以在以下位置找到目标文件

构建后的链接也完成了。

0 投票
1 回答
77 浏览

c - Segmentation fault when parsing group elemnt with libconfig

I'm trying to write C code to parse a config file using libconfig

The config file contains a simple element and a group. A group is composed of multiple settings, each has a unique name. ref

Config file :

I want to parse all RCUs data and store it in a data structre (the storing part is not a problem for now).

So I'm using the simple steps of :

  1. Store the group in a config_setting_t * called section.
  2. get length of section in a varaible called len
  3. Iterrate len time to read RCUs data.

The problem is when i want to read RCU data i get a seg fault.

Code :

Something strange I noticed is when I compile the code i get this warning :

parse.c: In function ‘main’: parse.c:46:14: warning: assignment to ‘config_setting_t *’ {aka ‘struct config_setting_t *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion] if(device = config_setting_get_elem(section, i) != NULL) {

GDB output :

Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7da78a0 in config_setting_get_member () from /lib/x86_64-linux-gnu/libconfig.so.9

ref to config_setting_get_elem(..)

I can not find what wrong Im doing. Everything looks correct to me.

Can someone see why the seg fault is happening?

0 投票
2 回答
100 浏览

c - C & libconfig: config_lookup_bool 返回 CONFIG_FALSE

我正在尝试从一组中读取布尔设置。我正在使用以下代码,但config_lookup_bool总是返回 CONFIG_FALSE。据我了解,它应该将值写入send_keys并返回 CONFIG_TRUE 。

代码:

配置文件:

我的代码或我的想法有什么错误吗?

0 投票
1 回答
113 浏览

c - 为什么 config_read_file() 返回 config_false?

我一直在将 libconfig 用于项目中的配置文件。当我通过 source_to_use 从源中删除双引号时,config_read_file() 返回 config_true 并且还有语法错误。语法错误将导致我的 source_to_use 选项的 getter 转到默认情况。也正因为如此,我的源数组的 getter 也将转到 else 案例。这可能只是我用 libconfig 格式犯了一个简单的语法错误吗?

这是我正在使用的配置文件:

这是我读到的功能:

0 投票
1 回答
49 浏览

c++ - 如何使用 libconfig 读取一个对象中的多个配置文件?

假设我有一个libconfig::config对象,我可以readFile像这样多次:

a.cfg如果并且b.cfg有相同的密钥会发生什么?

如果这不起作用,是否有任何方法可以让我将两个配置文件的设置合并到一个对象中?

0 投票
1 回答
57 浏览

c - Libconfig 和 unsigned long。UL如何操作?

我有一个问题:

你知道如何从主这个值 1024UL 中检索吗?它不是整数,而是特定的 int(无符号长整数)。我还没有找到这样做的功能。您可以看到函数 config_setting_lookup_int,但显然它不起作用,因为要检索的值不是 int (1024UL)。谢谢大家的帮助!

0 投票
0 回答
41 浏览

c - 如何解决这个指针错误?(来自不兼容的指针类型)

我有这个函数:(myvariable is un unsigned int) config_setting_lookup_int64 是 libconfig.h 函数 -> int config_lookup_int64 (const config t * config, [Function] const char * path, long long * value)

config_setting_lookup_int64(file, "myvariable", &myvariable);

我可以看到这个警告:从不兼容的指针类型传递 'config_setting_lookup_int64' 的参数 3

为了解决这个问题,我试着写:

但我可以看到另一个警告:传递 'config_setting_lookup_int64' 的参数 3 使指针从 integer 没有 cast。我该如何解决这个问题?太感谢了!