<
html>
<
head>
<
meta name="author" content="ndevilla@free.fr">
<
meta name="keywords" content="ini file, config file, parser, C library">
<
link href="doxygen.css" rel="stylesheet" type="text/css">
<
title>iniparser
2.x<
/title>
<
/head>
<
body text="#000000" bgcolor="#ffffff">
<!-- Generated by Doxygen 1.4.4 -->
<
div class="nav">
<
a class="el" href="dir_000000.html">src<
/a><
/div>
<
h1>iniparser.h File Reference<
/h1>Parser
for ini files. <
a href="#_details">More...<
/a>
<
p>
<
table border="0" cellpadding="0" cellspacing="0">
<
tr><
td><
/td><
/tr>
<
tr><
td colspan="2"><
br><
h2>Functions<
/h2><
/td><
/tr>
<
tr><
td class="memItemLeft" nowrap align="right" valign="top">int <
/td><
td class="memItemRight" valign="bottom"><
a class="el" href="iniparser_8h.html#a0">iniparser_getnsec<
/a>
(dictionary *d
)<
/td><
/tr>
<
tr><
td class="mdescLeft"> <
/td><
td class="mdescRight">Get number of sections in a dictionary. <
a href="#a0"><
/a><
br><
/td><
/tr>
<
tr><
td class="memItemLeft" nowrap align="right" valign="top">
char * <
/td><
td class="memItemRight" valign="bottom"><
a class="el" href="iniparser_8h.html#a1">iniparser_getsecname<
/a>
(dictionary *d, int n
)<
/td><
/tr>
<
tr><
td class="mdescLeft"> <
/td><
td class="mdescRight">Get
name for section n in a dictionary. <
a href="#a1"><
/a><
br><
/td><
/tr>
<
tr><
td class="memItemLeft" nowrap align="right" valign="top">void <
/td><
td class="memItemRight" valign="bottom"><
a class="el" href="iniparser_8h.html#a2">iniparser_dump_ini<
/a>
(dictionary *d, FILE *f
)<
/td><
/tr>
<
tr><
td class="mdescLeft"> <
/td><
td class="mdescRight">Save a dictionary to a loadable ini file. <
a href="#a2"><
/a><
br><
/td><
/tr>
<
tr><
td class="memItemLeft" nowrap align="right" valign="top">void <
/td><
td class="memItemRight" valign="bottom"><
a class="el" href="iniparser_8h.html#a3">iniparser_dump<
/a>
(dictionary *d, FILE *f
)<
/td><
/tr>
<
tr><
td class="mdescLeft"> <
/td><
td class="mdescRight">Dump a dictionary to an opened file pointer. <
a href="#a3"><
/a><
br><
/td><
/tr>
<
tr><
td class="memItemLeft" nowrap align="right" valign="top">
char * <
/td><
td class="memItemRight" valign="bottom"><
a class="el" href="iniparser_8h.html#a4">iniparser_getstr<
/a>
(dictionary *d,
char *key
)<
/td><
/tr>
<
tr><
td class="mdescLeft"> <
/td><
td class="mdescRight">Get the string associated to a key, return NULL if not found. <
a href="#a4"><
/a><
br><
/td><
/tr>
<
tr><
td class="memItemLeft" nowrap align="right" valign="top">
char * <
/td><
td class="memItemRight" valign="bottom"><
a class="el" href="iniparser_8h.html#a5">iniparser_getstring<
/a>
(dictionary *d,
char *key,
char *def
)<
/td><
/tr>
<
tr><
td class="mdescLeft"> <
/td><
td class="mdescRight">Get the string associated to a key. <
a href="#a5"><
/a><
br><
/td><
/tr>
<
tr><
td class="memItemLeft" nowrap align="right" valign="top">int <
/td><
td class="memItemRight" valign="bottom"><
a class="el" href="iniparser_8h.html#a6">iniparser_getint<
/a>
(dictionary *d,
char *key, int notfound
)<
/td><
/tr>
<
tr><
td class="mdescLeft"> <
/td><
td class="mdescRight">Get the string associated to a key, convert to an int. <
a href="#a6"><
/a><
br><
/td><
/tr>
<
tr><
td class="memItemLeft" nowrap align="right" valign="top">double <
/td><
td class="memItemRight" valign="bottom"><
a class="el" href="iniparser_8h.html#a7">iniparser_getdouble<
/a>
(dictionary *d,
char *key, double notfound
)<
/td><
/tr>
<
tr><
td class="mdescLeft"> <
/td><
td class="mdescRight">Get the string associated to a key, convert to a double. <
a href="#a7"><
/a><
br><
/td><
/tr>
<
tr><
td class="memItemLeft" nowrap align="right" valign="top">int <
/td><
td class="memItemRight" valign="bottom"><
a class="el" href="iniparser_8h.html#a8">iniparser_getboolean<
/a>
(dictionary *d,
char *key, int notfound
)<
/td><
/tr>
<
tr><
td class="mdescLeft"> <
/td><
td class="mdescRight">Get the string associated to a key, convert to a boolean. <
a href="#a8"><
/a><
br><
/td><
/tr>
<
tr><
td class="memItemLeft" nowrap align="right" valign="top">int <
/td><
td class="memItemRight" valign="bottom"><
a class="el" href="iniparser_8h.html#a9">iniparser_setstr<
/a>
(dictionary *ini,
char *entry,
char *val
)<
/td><
/tr>
<
tr><
td class="mdescLeft"> <
/td><
td class="mdescRight">Set an entry in a dictionary. <
a href="#a9"><
/a><
br><
/td><
/tr>
<
tr><
td class="memItemLeft" nowrap align="right" valign="top">void <
/td><
td class="memItemRight" valign="bottom"><
a class="el" href="iniparser_8h.html#a10">iniparser_unset<
/a>
(dictionary *ini,
char *entry
)<
/td><
/tr>
<
tr><
td class="mdescLeft"> <
/td><
td class="mdescRight">Delete an entry in a dictionary. <
a href="#a10"><
/a><
br><
/td><
/tr>
<
tr><
td class="memItemLeft" nowrap align="right" valign="top">int <
/td><
td class="memItemRight" valign="bottom"><
a class="el" href="iniparser_8h.html#a11">iniparser_find_entry<
/a>
(dictionary *ini,
char *entry
)<
/td><
/tr>
<
tr><
td class="mdescLeft"> <
/td><
td class="mdescRight">Finds out if a given entry exists in a dictionary. <
a href="#a11"><
/a><
br><
/td><
/tr>
<
tr><
td class="memItemLeft" nowrap align="right" valign="top">dictionary * <
/td><
td class="memItemRight" valign="bottom"><
a class="el" href="iniparser_8h.html#a12">iniparser_load<
/a>
(char *ininame
)<
/td><
/tr>
<
tr><
td class="mdescLeft"> <
/td><
td class="mdescRight">Parse an ini file and return an allocated dictionary
object. <
a href="#a12"><
/a><
br><
/td><
/tr>
<
tr><
td class="memItemLeft" nowrap align="right" valign="top">void <
/td><
td class="memItemRight" valign="bottom"><
a class="el" href="iniparser_8h.html#a13">iniparser_freedict<
/a>
(dictionary *d
)<
/td><
/tr>
<
tr><
td class="mdescLeft"> <
/td><
td class="mdescRight">Free all memory associated to an ini dictionary. <
a href="#a13"><
/a><
br><
/td><
/tr>
<
/table>
<
hr><
a name="_details"><
/a><
h2>Detailed Description<
/h2>
Parser
for ini files.
<
p>
<
dl compact><
dt><
b>Author:<
/b><
/dt><
dd>N. Devillard <
/dd><
/dl>
<
dl compact><
dt><
b>Date:<
/b><
/dt><
dd>Mar
2000 <
/dd><
/dl>
<
dl compact><
dt><
b>
Version:<
/b><
/dt><
dd><
dl compact><
dt><
b>Revision<
/b><
/dt><
dd>
1.20 <
/dd><
/dl>
<
/dd><
/dl>
<
hr><
h2>Function Documentation<
/h2>
<
a class="anchor" name="a3"><
/a><!-- doxytag: member
="iniparser.h::iniparser_dump" ref
="a3" args
="(dictionary *d, FILE *f)" --><
p>
<
table class="mdTable" cellpadding="2" cellspacing="0">
<
tr>
<
td class="mdRow">
<
table cellpadding="0" cellspacing="0" border="0">
<
tr>
<
td class="md" nowrap valign="top">void iniparser_dump <
/td>
<
td class="md" valign="top">
( <
/td>
<
td class="md" nowrap valign="top">dictionary * <
/td>
<
td class="mdname" nowrap> <
em>d<
/em>, <
/td>
<
/tr>
<
tr>
<
td class="md" nowrap align="right"><
/td>
<
td class="md"><
/td>
<
td class="md" nowrap>FILE * <
/td>
<
td class="mdname" nowrap> <
em>f<
/em><
/td>
<
/tr>
<
tr>
<
td class="md"><
/td>
<
td class="md">
) <
/td>
<
td class="md" colspan="2"><
/td>
<
/tr>
<
/table>
<
/td>
<
/tr>
<
/table>
<
table cellspacing="5" cellpadding="0" border="0">
<
tr>
<
td>
<
/td>
<
td>
<
p>
Dump a dictionary to an opened file pointer.
<
p>
<
dl compact><
dt><
b>Parameters:<
/b><
/dt><
dd>
<
table border="0" cellspacing="2" cellpadding="0">
<
tr><
td valign="top"><
/td><
td valign="top"><
em>d<
/em> <
/td><
td>Dictionary to dump. <
/td><
/tr>
<
tr><
td valign="top"><
/td><
td valign="top"><
em>f<
/em> <
/td><
td>Opened file pointer to dump to. <
/td><
/tr>
<
/table>
<
/dl>
<
dl compact><
dt><
b>Returns:<
/b><
/dt><
dd>void<
/dd><
/dl>
This function prints out the contents of a dictionary, one element by line, onto the provided file pointer. It is OK to specify <
code>stderr<
/code> or <
code>stdout<
/code> as output files. This function is meant
for debugging purposes mostly. <
/td>
<
/tr>
<
/table>
<
a class="anchor" name="a2"><
/a><!-- doxytag: member
="iniparser.h::iniparser_dump_ini" ref
="a2" args
="(dictionary *d, FILE *f)" --><
p>
<
table class="mdTable" cellpadding="2" cellspacing="0">
<
tr>
<
td class="mdRow">
<
table cellpadding="0" cellspacing="0" border="0">
<
tr>
<
td class="md" nowrap valign="top">void iniparser_dump_ini <
/td>
<
td class="md" valign="top">
( <
/td>
<
td class="md" nowrap valign="top">dictionary * <
/td>
<
td class="mdname" nowrap> <
em>d<
/em>, <
/td>
<
/tr>
<
tr>
<
td class="md" nowrap align="right"><
/td>
<
td class="md"><
/td>
<
td class="md" nowrap>FILE * <
/td>
<
td class="mdname" nowrap> <
em>f<
/em><
/td>
<
/tr>
<
tr>
<
td class="md"><
/td>
<
td class="md">
) <
/td>
<
td class="md" colspan="2"><
/td>
<
/tr>
<
/table>
<
/td>
<
/tr>
<
/table>
<
table cellspacing="5" cellpadding="0" border="0">
<
tr>
<
td>
<
/td>
<
td>
<
p>
Save a dictionary to a loadable ini file.
<
p>
<
dl compact><
dt><
b>Parameters:<
/b><
/dt><
dd>
<
table border="0" cellspacing="2" cellpadding="0">
<
tr><
td valign="top"><
/td><
td valign="top"><
em>d<
/em> <
/td><
td>Dictionary to dump <
/td><
/tr>
<
tr><
td valign="top"><
/td><
td valign="top"><
em>f<
/em> <
/td><
td>Opened file pointer to dump to <
/td><
/tr>
<
/table>
<
/dl>
<
dl compact><
dt><
b>Returns:<
/b><
/dt><
dd>void<
/dd><
/dl>
This function dumps a given dictionary into a loadable ini file. It is Ok to specify <
code>stderr<
/code> or <
code>stdout<
/code> as output files. <
/td>
<
/tr>
<
/table>
<
a class="anchor" name="a11"><
/a><!-- doxytag: member
="iniparser.h::iniparser_find_entry" ref
="a11" args
="(dictionary *ini, char *entry)" --><
p>
<
table class="mdTable" cellpadding="2" cellspacing="0">
<
tr>
<
td class="mdRow">
<
table cellpadding="0" cellspacing="0" border="0">
<
tr>
<
td class="md" nowrap valign="top">int iniparser_find_entry <
/td>
<
td class="md" valign="top">
( <
/td>
<
td class="md" nowrap valign="top">dictionary * <
/td>
<
td class="mdname" nowrap> <
em>ini<
/em>, <
/td>
<
/tr>
<
tr>
<
td class="md" nowrap align="right"><
/td>
<
td class="md"><
/td>
<
td class="md" nowrap>
char * <
/td>
<
td class="mdname" nowrap> <
em>entry<
/em><
/td>
<
/tr>
<
tr>
<
td class="md"><
/td>
<
td class="md">
) <
/td>
<
td class="md" colspan="2"><
/td>
<
/tr>
<
/table>
<
/td>
<
/tr>
<
/table>
<
table cellspacing="5" cellpadding="0" border="0">
<
tr>
<
td>
<
/td>
<
td>
<
p>
Finds out if a given entry exists in a dictionary.
<
p>
<
dl compact><
dt><
b>Parameters:<
/b><
/dt><
dd>
<
table border="0" cellspacing="2" cellpadding="0">
<
tr><
td valign="top"><
/td><
td valign="top"><
em>ini<
/em> <
/td><
td>Dictionary to search <
/td><
/tr>
<
tr><
td valign="top"><
/td><
td valign="top"><
em>entry<
/em> <
/td><
td>
Name of the entry to look
for <
/td><
/tr>
<
/table>
<
/dl>
<
dl compact><
dt><
b>Returns:<
/b><
/dt><
dd>integer
1 if entry exists,
0 otherwise<
/dd><
/dl>
Finds out if a given entry exists in the dictionary. Since sections are stored as keys with NULL associated values, this is the only way of querying
for the presence of sections in a dictionary. <
/td>
<
/tr>
<
/table>
<
a class="anchor" name="a13"><
/a><!-- doxytag: member
="iniparser.h::iniparser_freedict" ref
="a13" args
="(dictionary *d)" --><
p>
<
table class="mdTable" cellpadding="2" cellspacing="0">
<
tr>
<
td class="mdRow">
<
table cellpadding="0" cellspacing="0" border="0">
<
tr>
<
td class="md" nowrap valign="top">void iniparser_freedict <
/td>
<
td class="md" valign="top">
( <
/td>
<
td class="md" nowrap valign="top">dictionary * <
/td>
<
td class="mdname1" valign="top" nowrap> <
em>d<
/em> <
/td>
<
td class="md" valign="top">
) <
/td>
<
td class="md" nowrap><
/td>
<
/tr>
<
/table>
<
/td>
<
/tr>
<
/table>
<
table cellspacing="5" cellpadding="0" border="0">
<
tr>
<
td>
<
/td>
<
td>
<
p>
Free all memory associated to an ini dictionary.
<
p>
<
dl compact><
dt><
b>Parameters:<
/b><
/dt><
dd>
<
table border="0" cellspacing="2" cellpadding="0">
<
tr><
td valign="top"><
/td><
td valign="top"><
em>d<
/em> <
/td><
td>Dictionary to free <
/td><
/tr>
<
/table>
<
/dl>
<
dl compact><
dt><
b>Returns:<
/b><
/dt><
dd>void<
/dd><
/dl>
Free all memory associated to an ini dictionary. It is mandatory to call this function before the dictionary
object gets out of the current context. <
/td>
<
/tr>
<
/table>
<
a class="anchor" name="a8"><
/a><!-- doxytag: member
="iniparser.h::iniparser_getboolean" ref
="a8" args
="(dictionary *d, char *key, int notfound)" --><
p>
<
table class="mdTable" cellpadding="2" cellspacing="0">
<
tr>
<
td class="mdRow">
<
table cellpadding="0" cellspacing="0" border="0">
<
tr>
<
td class="md" nowrap valign="top">int iniparser_getboolean <
/td>
<
td class="md" valign="top">
( <
/td>
<
td class="md" nowrap valign="top">dictionary * <
/td>
<
td class="mdname" nowrap> <
em>d<
/em>, <
/td>
<
/tr>
<
tr>
<
td class="md" nowrap align="right"><
/td>
<
td class="md"><
/td>
<
td class="md" nowrap>
char * <
/td>
<
td class="mdname" nowrap> <
em>key<
/em>, <
/td>
<
/tr>
<
tr>
<
td class="md" nowrap align="right"><
/td>
<
td class="md"><
/td>
<
td class="md" nowrap>int <
/td>
<
td class="mdname" nowrap> <
em>notfound<
/em><
/td>
<
/tr>
<
tr>
<
td class="md"><
/td>
<
td class="md">
) <
/td>
<
td class="md" colspan="2"><
/td>
<
/tr>
<
/table>
<
/td>
<
/tr>
<
/table>
<
table cellspacing="5" cellpadding="0" border="0">
<
tr>
<
td>
<
/td>
<
td>
<
p>
Get the string associated to a key, convert to a boolean.
<
p>
<
dl compact><
dt><
b>Parameters:<
/b><
/dt><
dd>
<
table border="0" cellspacing="2" cellpadding="0">
<
tr><
td valign="top"><
/td><
td valign="top"><
em>d<
/em> <
/td><
td>Dictionary to search <
/td><
/tr>
<
tr><
td valign="top"><
/td><
td valign="top"><
em>key<
/em> <
/td><
td>Key string to look
for <
/td><
/tr>
<
tr><
td valign="top"><
/td><
td valign="top"><
em>notfound<
/em> <
/td><
td>
Value to return in case of error <
/td><
/tr>
<
/table>
<
/dl>
<
dl compact><
dt><
b>Returns:<
/b><
/dt><
dd>integer<
/dd><
/dl>
This function queries a dictionary
for a key. A key as read from an ini file is given as
"section:key". If the key cannot be found, the notfound
value is returned.<
p>
A true boolean is found if one of the following is matched:<
p>
<
ul>
<
li>A string starting with
'y'<
/li><
li>A string starting with
'Y'<
/li><
li>A string starting with
't'<
/li><
li>A string starting with
'T'<
/li><
li>A string starting with
'1'<
/li><
/ul>
<
p>
A false boolean is found if one of the following is matched:<
p>
<
ul>
<
li>A string starting with
'n'<
/li><
li>A string starting with
'N'<
/li><
li>A string starting with
'f'<
/li><
li>A string starting with
'F'<
/li><
li>A string starting with
'0'<
/li><
/ul>
<
p>
The notfound
value returned if no boolean is identified, does not necessarily have to be
0 or
1. <
/td>
<
/tr>
<
/table>
<
a class="anchor" name="a7"><
/a><!-- doxytag: member
="iniparser.h::iniparser_getdouble" ref
="a7" args
="(dictionary *d, char *key, double notfound)" --><
p>
<
table class="mdTable" cellpadding="2" cellspacing="0">
<
tr>
<
td class="mdRow">
<
table cellpadding="0" cellspacing="0" border="0">
<
tr>
<
td class="md" nowrap valign="top">double iniparser_getdouble <
/td>
<
td class="md" valign="top">
( <
/td>
<
td class="md" nowrap valign="top">dictionary * <
/td>
<
td class="mdname" nowrap> <
em>d<
/em>, <
/td>
<
/tr>
<
tr>
<
td class="md" nowrap align="right"><
/td>
<
td class="md"><
/td>
<
td class="md" nowrap>
char * <
/td>
<
td class="mdname" nowrap> <
em>key<
/em>, <
/td>
<
/tr>
<
tr>
<
td class="md" nowrap align="right"><
/td>
<
td class="md"><
/td>
<
td class="md" nowrap>double <
/td>
<
td class="mdname" nowrap> <
em>notfound<
/em><
/td>
<
/tr>
<
tr>
<
td class="md"><
/td>
<
td class="md">
) <
/td>
<
td class="md" colspan="2"><
/td>
<
/tr>
<
/table>
<
/td>
<
/tr>
<
/table>
<
table cellspacing="5" cellpadding="0" border="0">
<
tr>
<
td>
<
/td>
<
td>
<
p>
Get the string associated to a key, convert to a double.
<
p>
<
dl compact><
dt><
b>Parameters:<
/b><
/dt><
dd>
<
table border="0" cellspacing="2" cellpadding="0">
<
tr><
td valign="top"><
/td><
td valign="top"><
em>d<
/em> <
/td><
td>Dictionary to search <
/td><
/tr>
<
tr><
td valign="top"><
/td><
td valign="top"><
em>key<
/em> <
/td><
td>Key string to look
for <
/td><
/tr>
<
tr><
td valign="top"><
/td><
td valign="top"><
em>notfound<
/em> <
/td><
td>
Value to return in case of error <
/td><
/tr>
<
/table>
<
/dl>
<
dl compact><
dt><
b>Returns:<
/b><
/dt><
dd>double<
/dd><
/dl>
This function queries a dictionary
for a key. A key as read from an ini file is given as
"section:key". If the key cannot be found, the notfound
value is returned. <
/td>
<
/tr>
<
/table>
<
a class="anchor" name="a6"><
/a><!-- doxytag: member
="iniparser.h::iniparser_getint" ref
="a6" args
="(dictionary *d, char *key, int notfound)" --><
p>
<
table class="mdTable" cellpadding="2" cellspacing="0">
<
tr>
<
td class="mdRow">
<
table cellpadding="0" cellspacing="0" border="0">
<
tr>
<
td class="md" nowrap valign="top">int iniparser_getint <
/td>
<
td class="md" valign="top">
( <
/td>
<
td class="md" nowrap valign="top">dictionary * <
/td>
<
td class="mdname" nowrap> <
em>d<
/em>, <
/td>
<
/tr>
<
tr>
<
td class="md" nowrap align="right"><
/td>
<
td class="md"><
/td>
<
td class="md" nowrap>
char * <
/td>
<
td class="mdname" nowrap> <
em>key<
/em>, <
/td>
<
/tr>
<
tr>
<
td class="md" nowrap align="right"><
/td>
<
td class="md"><
/td>
<
td class="md" nowrap>int <
/td>
<
td class="mdname" nowrap> <
em>notfound<
/em><
/td>
<
/tr>
<
tr>
<
td class="md"><
/td>
<
td class="md">
) <
/td>
<
td class="md" colspan="2"><
/td>
<
/tr>
<
/table>
<
/td>
<
/tr>
<
/table>
<
table cellspacing="5" cellpadding="0" border="0">
<
tr>
<
td>
<
/td>
<
td>
<
p>
Get the string associated to a key, convert to an int.
<
p>
<
dl compact><
dt><
b>Parameters:<
/b><
/dt><
dd>
<
table border="0" cellspacing="2" cellpadding="0">
<
tr><
td valign="top"><
/td><
td valign="top"><
em>d<
/em> <
/td><
td>Dictionary to search <
/td><
/tr>
<
tr><
td valign="top"><
/td><
td valign="top"><
em>key<
/em> <
/td><
td>Key string to look
for <
/td><
/tr>
<
tr><
td valign="top"><
/td><
td valign="top"><
em>notfound<
/em> <
/td><
td>
Value to return in case of error <
/td><
/tr>
<
/table>
<
/dl>
<
dl compact><
dt><
b>Returns:<
/b><
/dt><
dd>integer<
/dd><
/dl>
This function queries a dictionary
for a key. A key as read from an ini file is given as
"section:key". If the key cannot be found, the notfound
value is returned. <
/td>
<
/tr>
<
/table>
<
a class="anchor" name="a0"><
/a><!-- doxytag: member
="iniparser.h::iniparser_getnsec" ref
="a0" args
="(dictionary *d)" --><
p>
<
table class="mdTable" cellpadding="2" cellspacing="0">
<
tr>
<
td class="mdRow">
<
table cellpadding="0" cellspacing="0" border="0">
<
tr>
<
td class="md" nowrap valign="top">int iniparser_getnsec <
/td>
<
td class="md" valign="top">
( <
/td>
<
td class="md" nowrap valign="top">dictionary * <
/td>
<
td class="mdname1" valign="top" nowrap> <
em>d<
/em> <
/td>
<
td class="md" valign="top">
) <
/td>
<
td class="md" nowrap><
/td>
<
/tr>
<
/table>
<
/td>
<
/tr>
<
/table>
<
table cellspacing="5" cellpadding="0" border="0">
<
tr>
<
td>
<
/td>
<
td>
<
p>
Get number of sections in a dictionary.
<
p>
<
dl compact><
dt><
b>Parameters:<
/b><
/dt><
dd>
<
table border="0" cellspacing="2" cellpadding="0">
<
tr><
td valign="top"><
/td><
td valign="top"><
em>d<
/em> <
/td><
td>Dictionary to examine <
/td><
/tr>
<
/table>
<
/dl>
<
dl compact><
dt><
b>Returns:<
/b><
/dt><
dd>int Number of sections found in dictionary<
/dd><
/dl>
This function returns the number of sections found in a dictionary. The test to recognize sections is done on the string stored in the dictionary: a section
name is given as
"section" whereas a key is stored as
"section:key", thus the test looks
for entries that do not contain a colon.<
p>
This clearly fails in the case a section
name contains a colon, but this should simply be avoided.<
p>
This function returns -
1 in case of error. <
/td>
<
/tr>
<
/table>
<
a class="anchor" name="a1"><
/a><!-- doxytag: member
="iniparser.h::iniparser_getsecname" ref
="a1" args
="(dictionary *d, int n)" --><
p>
<
table class="mdTable" cellpadding="2" cellspacing="0">
<
tr>
<
td class="mdRow">
<
table cellpadding="0" cellspacing="0" border="0">
<
tr>
<
td class="md" nowrap valign="top">
char* iniparser_getsecname <
/td>
<
td class="md" valign="top">
( <
/td>
<
td class="md" nowrap valign="top">dictionary * <
/td>
<
td class="mdname" nowrap> <
em>d<
/em>, <
/td>
<
/tr>
<
tr>
<
td class="md" nowrap align="right"><
/td>
<
td class="md"><
/td>
<
td class="md" nowrap>int <
/td>
<
td class="mdname" nowrap> <
em>n<
/em><
/td>
<
/tr>
<
tr>
<
td class="md"><
/td>
<
td class="md">
) <
/td>
<
td class="md" colspan="2"><
/td>
<
/tr>
<
/table>
<
/td>
<
/tr>
<
/table>
<
table cellspacing="5" cellpadding="0" border="0">
<
tr>
<
td>
<
/td>
<
td>
<
p>
Get
name for section n in a dictionary.
<
p>
<
dl compact><
dt><
b>Parameters:<
/b><
/dt><
dd>
<
table border="0" cellspacing="2" cellpadding="0">
<
tr><
td valign="top"><
/td><
td valign="top"><
em>d<
/em> <
/td><
td>Dictionary to examine <
/td><
/tr>
<
tr><
td valign="top"><
/td><
td valign="top"><
em>n<
/em> <
/td><
td>Section number
(from
0 to nsec-
1). <
/td><
/tr>
<
/table>
<
/dl>
<
dl compact><
dt><
b>Returns:<
/b><
/dt><
dd>Pointer to
char string<
/dd><
/dl>
This function locates the n-th section in a dictionary and returns its
name as a pointer to a string statically allocated inside the dictionary. Do not free or modify the returned string!<
p>
This function returns NULL in case of error. <
/td>
<
/tr>
<
/table>
<
a class="anchor" name="a4"><
/a><!-- doxytag: member
="iniparser.h::iniparser_getstr" ref
="a4" args
="(dictionary *d, char *key)" --><
p>
<
table class="mdTable" cellpadding="2" cellspacing="0">
<
tr>
<
td class="mdRow">
<
table cellpadding="0" cellspacing="0" border="0">
<
tr>
<
td class="md" nowrap valign="top">
char* iniparser_getstr <
/td>
<
td class="md" valign="top">
( <
/td>
<
td class="md" nowrap valign="top">dictionary * <
/td>
<
td class="mdname" nowrap> <
em>d<
/em>, <
/td>
<
/tr>
<
tr>
<
td class="md" nowrap align="right"><
/td>
<
td class="md"><
/td>
<
td class="md" nowrap>
char * <
/td>
<
td class="mdname" nowrap> <
em>key<
/em><
/td>
<
/tr>
<
tr>
<
td class="md"><
/td>
<
td class="md">
) <
/td>
<
td class="md" colspan="2"><
/td>
<
/tr>
<
/table>
<
/td>
<
/tr>
<
/table>
<
table cellspacing="5" cellpadding="0" border="0">
<
tr>
<
td>
<
/td>
<
td>
<
p>
Get the string associated to a key, return NULL if not found.
<
p>
<
dl compact><
dt><
b>Parameters:<
/b><
/dt><
dd>
<
table border="0" cellspacing="2" cellpadding="0">
<
tr><
td valign="top"><
/td><
td valign="top"><
em>d<
/em> <
/td><
td>Dictionary to search <
/td><
/tr>
<
tr><
td valign="top"><
/td><
td valign="top"><
em>key<
/em> <
/td><
td>Key string to look
for <
/td><
/tr>
<
/table>
<
/dl>
<
dl compact><
dt><
b>Returns:<
/b><
/dt><
dd>pointer to statically allocated character string, or NULL.<
/dd><
/dl>
This function queries a dictionary
for a key. A key as read from an ini file is given as
"section:key". If the key cannot be found, NULL is returned. The returned
char pointer is pointing to a string allocated in the dictionary, do not free or modify it.<
p>
This function is only provided
for backwards compatibility with previous versions of iniparser. It is recommended to use <
a class="el" href="iniparser_8h.html#a5">iniparser_getstring
()<
/a> instead. <
/td>
<
/tr>
<
/table>
<
a class="anchor" name="a5"><
/a><!-- doxytag: member
="iniparser.h::iniparser_getstring" ref
="a5" args
="(dictionary *d, char *key, char *def)" --><
p>
<
table class="mdTable" cellpadding="2" cellspacing="0">
<
tr>
<
td class="mdRow">
<
table cellpadding="0" cellspacing="0" border="0">
<
tr>
<
td class="md" nowrap valign="top">
char* iniparser_getstring <
/td>
<
td class="md" valign="top">
( <
/td>
<
td class="md" nowrap valign="top">dictionary * <
/td>
<
td class="mdname" nowrap> <
em>d<
/em>, <
/td>
<
/tr>
<
tr>
<
td class="md" nowrap align="right"><
/td>
<
td class="md"><
/td>
<
td class="md" nowrap>
char * <
/td>
<
td class="mdname" nowrap> <
em>key<
/em>, <
/td>
<
/tr>
<
tr>
<
td class="md" nowrap align="right"><
/td>
<
td class="md"><
/td>
<
td class="md" nowrap>
char * <
/td>
<
td class="mdname" nowrap> <
em>def<
/em><
/td>
<
/tr>
<
tr>
<
td class="md"><
/td>
<
td class="md">
) <
/td>
<
td class="md" colspan="2"><
/td>
<
/tr>
<
/table>
<
/td>
<
/tr>
<
/table>
<
table cellspacing="5" cellpadding="0" border="0">
<
tr>
<
td>
<
/td>
<
td>
<
p>
Get the string associated to a key.
<
p>
<
dl compact><
dt><
b>Parameters:<
/b><
/dt><
dd>
<
table border="0" cellspacing="2" cellpadding="0">
<
tr><
td valign="top"><
/td><
td valign="top"><
em>d<
/em> <
/td><
td>Dictionary to search <
/td><
/tr>
<
tr><
td valign="top"><
/td><
td valign="top"><
em>key<
/em> <
/td><
td>Key string to look
for <
/td><
/tr>
<
tr><
td valign="top"><
/td><
td valign="top"><
em>def<
/em> <
/td><
td>Default
value to return if key not found. <
/td><
/tr>
<
/table>
<
/dl>
<
dl compact><
dt><
b>Returns:<
/b><
/dt><
dd>pointer to statically allocated character string<
/dd><
/dl>
This function queries a dictionary
for a key. A key as read from an ini file is given as
"section:key". If the key cannot be found, the pointer passed as
'def' is returned. The returned
char pointer is pointing to a string allocated in the dictionary, do not free or modify it. <
/td>
<
/tr>
<
/table>
<
a class="anchor" name="a12"><
/a><!-- doxytag: member
="iniparser.h::iniparser_load" ref
="a12" args
="(char *ininame)" --><
p>
<
table class="mdTable" cellpadding="2" cellspacing="0">
<
tr>
<
td class="mdRow">
<
table cellpadding="0" cellspacing="0" border="0">
<
tr>
<
td class="md" nowrap valign="top">dictionary* iniparser_load <
/td>
<
td class="md" valign="top">
( <
/td>
<
td class="md" nowrap valign="top">
char * <
/td>
<
td class="mdname1" valign="top" nowrap> <
em>ininame<
/em> <
/td>
<
td class="md" valign="top">
) <
/td>
<
td class="md" nowrap><
/td>
<
/tr>
<
/table>
<
/td>
<
/tr>
<
/table>
<
table cellspacing="5" cellpadding="0" border="0">
<
tr>
<
td>
<
/td>
<
td>
<
p>
Parse an ini file and return an allocated dictionary
object.
<
p>
<
dl compact><
dt><
b>Parameters:<
/b><
/dt><
dd>
<
table border="0" cellspacing="2" cellpadding="0">
<
tr><
td valign="top"><
/td><
td valign="top"><
em>ininame<
/em> <
/td><
td>
Name of the ini file to read. <
/td><
/tr>
<
/table>
<
/dl>
<
dl compact><
dt><
b>Returns:<
/b><
/dt><
dd>Pointer to newly allocated dictionary<
/dd><
/dl>
This is the parser
for ini files. This function is called, providing the
name of the file to be read. It returns a dictionary
object that should not be accessed directly, but through accessor functions instead.<
p>
The returned dictionary must be freed using <
a class="el" href="iniparser_8h.html#a13">iniparser_freedict
()<
/a>. <
/td>
<
/tr>
<
/table>
<
a class="anchor" name="a9"><
/a><!-- doxytag: member
="iniparser.h::iniparser_setstr" ref
="a9" args
="(dictionary *ini, char *entry, char *val)" --><
p>
<
table class="mdTable" cellpadding="2" cellspacing="0">
<
tr>
<
td class="mdRow">
<
table cellpadding="0" cellspacing="0" border="0">
<
tr>
<
td class="md" nowrap valign="top">int iniparser_setstr <
/td>
<
td class="md" valign="top">
( <
/td>
<
td class="md" nowrap valign="top">dictionary * <
/td>
<
td class="mdname" nowrap> <
em>ini<
/em>, <
/td>
<
/tr>
<
tr>
<
td class="md" nowrap align="right"><
/td>
<
td class="md"><
/td>
<
td class="md" nowrap>
char * <
/td>
<
td class="mdname" nowrap> <
em>entry<
/em>, <
/td>
<
/tr>
<
tr>
<
td class="md" nowrap align="right"><
/td>
<
td class="md"><
/td>
<
td class="md" nowrap>
char * <
/td>
<
td class="mdname" nowrap> <
em>val<
/em><
/td>
<
/tr>
<
tr>
<
td class="md"><
/td>
<
td class="md">
) <
/td>
<
td class="md" colspan="2"><
/td>
<
/tr>
<
/table>
<
/td>
<
/tr>
<
/table>
<
table cellspacing="5" cellpadding="0" border="0">
<
tr>
<
td>
<
/td>
<
td>
<
p>
Set an entry in a dictionary.
<
p>
<
dl compact><
dt><
b>Parameters:<
/b><
/dt><
dd>
<
table border="0" cellspacing="2" cellpadding="0">
<
tr><
td valign="top"><
/td><
td valign="top"><
em>ini<
/em> <
/td><
td>Dictionary to modify. <
/td><
/tr>
<
tr><
td valign="top"><
/td><
td valign="top"><
em>entry<
/em> <
/td><
td>Entry to modify
(entry
name) <
/td><
/tr>
<
tr><
td valign="top"><
/td><
td valign="top"><
em>val<
/em> <
/td><
td>New
value to associate to the entry. <
/td><
/tr>
<
/table>
<
/dl>
<
dl compact><
dt><
b>Returns:<
/b><
/dt><
dd>int
0 if Ok, -
1 otherwise.<
/dd><
/dl>
If the given entry can be found in the dictionary, it is modified to contain the provided
value. If it cannot be found, -
1 is returned. It is Ok to set val to NULL. <
/td>
<
/tr>
<
/table>
<
a class="anchor" name="a10"><
/a><!-- doxytag: member
="iniparser.h::iniparser_unset" ref
="a10" args
="(dictionary *ini, char *entry)" --><
p>
<
table class="mdTable" cellpadding="2" cellspacing="0">
<
tr>
<
td class="mdRow">
<
table cellpadding="0" cellspacing="0" border="0">
<
tr>
<
td class="md" nowrap valign="top">void iniparser_unset <
/td>
<
td class="md" valign="top">
( <
/td>
<
td class="md" nowrap valign="top">dictionary * <
/td>
<
td class="mdname" nowrap> <
em>ini<
/em>, <
/td>
<
/tr>
<
tr>
<
td class="md" nowrap align="right"><
/td>
<
td class="md"><
/td>
<
td class="md" nowrap>
char * <
/td>
<
td class="mdname" nowrap> <
em>entry<
/em><
/td>
<
/tr>
<
tr>
<
td class="md"><
/td>
<
td class="md">
) <
/td>
<
td class="md" colspan="2"><
/td>
<
/tr>
<
/table>
<
/td>
<
/tr>
<
/table>
<
table cellspacing="5" cellpadding="0" border="0">
<
tr>
<
td>
<
/td>
<
td>
<
p>
Delete an entry in a dictionary.
<
p>
<
dl compact><
dt><
b>Parameters:<
/b><
/dt><
dd>
<
table border="0" cellspacing="2" cellpadding="0">
<
tr><
td valign="top"><
/td><
td valign="top"><
em>ini<
/em> <
/td><
td>Dictionary to modify <
/td><
/tr>
<
tr><
td valign="top"><
/td><
td valign="top"><
em>entry<
/em> <
/td><
td>Entry to delete
(entry
name) <
/td><
/tr>
<
/table>
<
/dl>
<
dl compact><
dt><
b>Returns:<
/b><
/dt><
dd>void<
/dd><
/dl>
If the given entry can be found, it is deleted from the dictionary. <
/td>
<
/tr>
<
/table>
<
/body>
<
/html>