aboutsummaryrefslogtreecommitdiffstats
path: root/samples/c/sample2.c
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2011-12-01 23:47:41 +0000
committerJonathan McCrohan <jmccrohan@gmail.com>2011-12-01 23:47:41 +0000
commit1eaceca55c7e62892fd28bfbb5fc03240a48cee3 (patch)
tree7243fcd09c57e06e72b15f0044fd2c77babd7843 /samples/c/sample2.c
parentd4b5ddf4bcacd692011f5a597025c38a1262d6ca (diff)
parent429e46051dba814e7d6c74368eb1bba550222cbe (diff)
downloadlibconfig-1eaceca55c7e62892fd28bfbb5fc03240a48cee3.tar.gz
Merge commit 'upstream/1.4.8'
Conflicts: debian/changelog debian/control debian/libconfig++9-dev.install debian/libconfig8.install debian/libconfig9-dev.install debian/rules
Diffstat (limited to '')
-rw-r--r--samples/c/sample2.c52
1 files changed, 0 insertions, 52 deletions
diff --git a/samples/c/sample2.c b/samples/c/sample2.c
deleted file mode 100644
index 09c45de..0000000
--- a/samples/c/sample2.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*************************************************************************
- ** Sample2
- ** Load sample.cfg and access the "values" array
- *************************************************************************/
-
-#include <stdio.h>
-#include <libconfig.h>
-
-struct config_t cfg;
-
-/***************************************************************************/
-
-int main()
-{
- /* Initialize the configuration */
- config_init(&cfg);
-
- /* Load the file */
- printf("loading [sample.cfg]..");
- if (!config_read_file(&cfg, "sample.cfg"))
- printf("failed\n");
- else
- {
- config_setting_t *array = NULL;
-
- printf("ok\n");
-
- /* Display the "values" array */
- printf("display \"values\"..");
- array = config_lookup(&cfg, "values");
- if (!array)
- printf("failed\n");
- else
- {
- long value1,value2;
- value1 = config_setting_get_int_elem(array, 0);
- value2 = config_setting_get_int_elem(array, 1);
- printf("[%lu %lu]..ok\n", value1, value2);
-
- printf("Done!\n");
- }
-
- }
-
- /* Free the configuration */
- config_destroy(&cfg);
-
- return 0;
-}
-
-
-/***************************************************************************/