--- embedaddon/confuse/doc/tutorial-html/index.html 2017/01/24 14:48:55 1.1.1.1 +++ embedaddon/confuse/doc/tutorial-html/index.html 2021/03/17 00:49:17 1.1.1.2 @@ -1,6 +1,5 @@ - - -libConfuse tutorial

libConfuse tutorial

Martin Hedenfalk


Table of Contents

1. Introducing libConfuse in an existing program
1.1. Environment variables in values
2. Other types of options
3. Introducing lists
4. Using sections
5. Parsing from internal buffers
6. Validating callback functions
6.1. Installing the callback
7. Value parsing callback
8. Functions
8.1. Predefined functions
9. Saving configuration files
9.1. Altering the printing of certain options

1. Introducing libConfuse in an existing program

Consider this simple program:

+
+libConfuse tutorial

libConfuse tutorial

Martin Hedenfalk


1. Introducing libConfuse in an existing program

Consider this simple program:

 1	#include <stdio.h>
 2	
 3	int main(void)
@@ -68,7 +67,7 @@ target = "Neighbour"
             Thus, if no target option was specified in the
             configuration file, the hello program would have printed the
             standard greeting "Hello, World".
-        

1.1. Environment variables in values

+

1.1. Environment variables in values

What else can we do in the configuration file? We can set the value to an environment variable:

@@ -82,4 +81,4 @@ target = ${USER:-User}
             

Now, if the USER environment variable is unset, the string "User" will be used instead. -

+

\ No newline at end of file