/* ---------------------------------------------------------------------------- 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 #include using namespace std; using namespace libconfig; // 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 cfg; Setting &root = cfg.getRoot(); // Add some settings to the configuration. Setting &address = root.add("address", Setting::TypeGroup); address.add("street", Setting::TypeString) = "1 Woz Way"; address.add("city", Setting::TypeString) = "San Jose"; address.add("state", Setting::TypeString) = "CA"; address.add("zip", Setting::TypeInt) = 95110; Setting &array = root.add("array", Setting::TypeArray); for(int i = 0; i < 10; ++i) array.add(Setting::TypeInt) = 10 * i; // Write out the new configuration. try { cfg.writeFile(output_file); cerr << "New configuration successfully written to: " << output_file << endl; } catch(const FileIOException &fioex) { cerr << "I/O error while writing file: " << output_file << endl; return(EXIT_FAILURE); } return(EXIT_SUCCESS); } // eof 6882af4476e2dc6098b78cfb&follow=1'>root/widget_icon.c (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2008-09-03ULA200 driver by Bernhard Wallemichael7-2/+825
2008-09-03indentmichael1-4/+4
2008-08-31Increased the maximum bps to 230400, if defined in <termios.h>.sonic741-2/+7
2008-08-27git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@889 3ae390bd-cb1e-0410-...sonic741-18/+11
2008-08-27D4D updates by Svenmichael1-38/+60
2008-08-03driver for 4D Systems serial displays by Sven Killigmichael9-45/+846
2008-08-03signed/unsigned mismatchmichael1-3/+3
2008-07-26added command functionsmichux1-2/+130
2008-07-15added IRLCD driver by Jean-Philippe Civademichael10-5/+467
2008-07-15'autoreconf -f -i' run & config.rpath addedmichael8-370/+1617