# Functions for C language for UNIX configuration files.



## valsorym (Nov 29, 2011)

Hello, tell me please,  whether there in a C language modules for reading configuration files?


I mean, that in Windows  used *.ini files, and development environments (such as Visual Studio, Borland Builder) have a module, for example IniFiles.hpp - for working with *.ini files. 

example;

```
#include <IniFiles.hpp>
...
TIniFile *options = new TIniFile("c:\\sys.ini");

init left = options->ReadInteger("Position", "Left", 250);
int top  = options->ReadInteger("Position", "Top", 200);

delete options;
```
But this is a C++. And for the *.ini. 
Is there a configuration file for the C? - vit FreeBSD is written entirely in C, and the whole tune with the conf files.

Need to receive data in a C program with a file type, such as

```
# comment...
# comment...
variable1 = "string value" # comment...
variable2 = 10
        variable3 = 3.5 # comment...
        variable4 = "ru_RU" # comment...
variable5 = "opt_${variable3}_${variable4 }"
```


----------



## SirDice (Nov 29, 2011)

There isn't one in the standard C library if that's what you were looking for.

A 10 second google search however showed a multitude of solutions.

http://ndevilla.free.fr/iniparser/

NB. .h files aren't 'configuration' files. They're called 'header files' and they usually accompany libraries.


----------



## valsorym (Nov 29, 2011)

Oh, if there are no standard libraries - it is better I'll write a set of functions for this it himself (myself).  (- sorry for my English).
Thank you!


----------



## SirDice (Nov 29, 2011)

doorways said:
			
		

> Oh, if there are no standard libraries - it is better I'll write a set of functions for this it myself.


Yeah, that's what everybody else seems to be doing :e

Shouldn't be too hard, there are plenty of examples on the internet.


----------



## valsorym (Nov 29, 2011)

Okay, I will work! Thank you!


----------



## Alt (Nov 29, 2011)

You can use something like libxml


----------

