/* ---------------------------------------------------------------------------- libconfig - A library for processing structured configuration files Copyright (C) 2005-2010 Mark A Lindner This file is part of libconfig. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, see . ---------------------------------------------------------------------------- */ #include #include #include /* This example constructs a new configuration in memory and writes it to * 'newconfig.cfg'. */ int main(int argc, char **argv) { static const char *output_file = "newconfig.cfg"; config_t cfg; config_setting_t *root, *setting, *group, *array; int i; config_init(&cfg); root = config_root_setting(&cfg); /* Add some settings to the configuration. */ group = config_setting_add(root, "address", CONFIG_TYPE_GROUP); setting = config_setting_add(group, "street", CONFIG_TYPE_STRING); config_setting_set_string(setting, "1 Woz Way"); setting = config_setting_add(group, "city", CONFIG_TYPE_STRING); config_setting_set_string(setting, "San Jose"); setting = config_setting_add(group, "state", CONFIG_TYPE_STRING); config_setting_set_string(setting, "CA"); setting = config_setting_add(group, "zip", CONFIG_TYPE_INT); config_setting_set_int(setting, 95110); array = config_setting_add(root, "numbers", CONFIG_TYPE_ARRAY); for(i = 0; i < 10; ++i) { setting = config_setting_add(array, NULL, CONFIG_TYPE_INT); config_setting_set_int(setting, 10 * i); } /* Write out the new configuration. */ if(! config_write_file(&cfg, output_file)) { fprintf(stderr, "Error while writing file.\n"); config_destroy(&cfg); return(EXIT_FAILURE); } fprintf(stderr, "New configuration successfully written to: %s\n", output_file); config_destroy(&cfg); return(EXIT_SUCCESS); } /* eof */ aecb2&showmsg=1'>unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2002-08-19[lcd4linux @ 2002-08-19 10:51:06 by reinelt]reinelt2-259/+60
M50530 driver using new generic bar functions git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@164 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2002-08-19[lcd4linux @ 2002-08-19 09:43:43 by reinelt]reinelt1-261/+57
BeckmannEgle using new generic bar functions git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@163 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2002-08-19[lcd4linux @ 2002-08-19 09:30:18 by reinelt]reinelt1-256/+106
MatrixOrbital uses generic bar funnctions git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@162 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2002-08-19[lcd4linux @ 2002-08-19 09:11:34 by reinelt]reinelt2-257/+51
changed HD44780 to use generic bar functions git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@161 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2002-08-19[lcd4linux @ 2002-08-19 07:52:19 by reinelt]reinelt3-8/+17
corrected type declaration of (*defchar)() git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@160 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2002-08-19[lcd4linux @ 2002-08-19 07:36:29 by reinelt]reinelt7-359/+481
finished bar.c, USBLCD is the first driver that uses the generic bar functions git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@159 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2002-08-19[lcd4linux @ 2002-08-19 04:41:20 by reinelt]reinelt20-32/+166
introduced bar.c, moved bar stuff from display.h to bar.h git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@158 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2002-08-18[lcd4linux @ 2002-08-18 08:11:11 by reinelt]reinelt1-26/+28
USBLCD buffered I/O git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@157 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2002-08-17[lcd4linux @ 2002-08-17 14:14:21 by reinelt]reinelt3-67/+101
USBLCD fixes git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@156 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2002-08-17[lcd4linux @ 2002-08-17 13:10:22 by reinelt]reinelt9-182/+765
USBLCD driver added git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@155 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2002-08-17[lcd4linux @ 2002-08-17 12:54:08 by reinelt]reinelt1-7/+23
minor T6963 changes git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@154 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2002-04-30[lcd4linux @ 2002-04-30 07:20:15 by reinelt]reinelt2-173/+129
implemented the new ndelay(nanoseconds) in all parallel port drivers git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@153 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2002-04-29[lcd4linux @ 2002-04-29 11:00:25 by reinelt]reinelt14-2339/+5100
added Toshiba T6963 driver added ndelay() with nanosecond resolution git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@152 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2001-09-14[lcd4linux @ 2001-09-14 05:57:06 by reinelt]reinelt1-1/+5
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@151 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2001-09-13[lcd4linux @ 2001-09-13 07:40:57 by reinelt]reinelt1-0/+6
TODO update git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@150 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2001-09-12[lcd4linux @ 2001-09-12 06:17:22 by reinelt]reinelt2-1/+8
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@149 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2001-09-12[lcd4linux @ 2001-09-12 05:58:16 by reinelt]reinelt3-9/+27
fixed bug in mail2.c git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@148 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2001-09-12[lcd4linux @ 2001-09-12 05:37:22 by reinelt]reinelt4-23/+99
fixed a bug in seti.c (file was never closed, lcd4linux run out of fd's improved socket debugging git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@147 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
2001-09-11[lcd4linux @ 2001-09-11 06:43:43 by reinelt]reinelt1-1/+10
TODO items git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@146 3ae390bd-cb1e-0410-b409-cd5a39f66f1f