⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iniparser_8h.html

📁 一个使用anci c实现的ini处理程序
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<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.2.17 --><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 nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="iniparser_8h.html#a0">iniparser_getnsec</a> (dictionary *d)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Get number of sections in a dictionary.</em> <a href="#a0"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>char *&nbsp;</td><td valign=bottom><a class="el" href="iniparser_8h.html#a1">iniparser_getsecname</a> (dictionary *d, int n)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Get name for section n in a dictionary.</em> <a href="#a1"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="iniparser_8h.html#a2">iniparser_dump_ini</a> (dictionary *d, FILE *f)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Save a dictionary to a loadable ini file.</em> <a href="#a2"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="iniparser_8h.html#a3">iniparser_dump</a> (dictionary *d, FILE *f)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Dump a dictionary to an opened file pointer.</em> <a href="#a3"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>char *&nbsp;</td><td valign=bottom><a class="el" href="iniparser_8h.html#a4">iniparser_getstr</a> (dictionary *d, char *key)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Get the string associated to a key, return NULL if not found.</em> <a href="#a4"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>char *&nbsp;</td><td valign=bottom><a class="el" href="iniparser_8h.html#a5">iniparser_getstring</a> (dictionary *d, char *key, char *def)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Get the string associated to a key.</em> <a href="#a5"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="iniparser_8h.html#a6">iniparser_getint</a> (dictionary *d, char *key, int notfound)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Get the string associated to a key, convert to an int.</em> <a href="#a6"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>double&nbsp;</td><td valign=bottom><a class="el" href="iniparser_8h.html#a7">iniparser_getdouble</a> (dictionary *d, char *key, double notfound)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Get the string associated to a key, convert to a double.</em> <a href="#a7"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="iniparser_8h.html#a8">iniparser_getboolean</a> (dictionary *d, char *key, int notfound)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Get the string associated to a key, convert to a boolean.</em> <a href="#a8"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="iniparser_8h.html#a9">iniparser_setstr</a> (dictionary *ini, char *entry, char *val)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Set an entry in a dictionary.</em> <a href="#a9"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="iniparser_8h.html#a10">iniparser_unset</a> (dictionary *ini, char *entry)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Delete an entry in a dictionary.</em> <a href="#a10"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="iniparser_8h.html#a11">iniparser_find_entry</a> (dictionary *ini, char *entry)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Finds out if a given entry exists in a dictionary.</em> <a href="#a11"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>dictionary *&nbsp;</td><td valign=bottom><a class="el" href="iniparser_8h.html#a12">iniparser_load</a> (char *ininame)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Parse an ini file and return an allocated dictionary object.</em> <a href="#a12"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="iniparser_8h.html#a13">iniparser_freedict</a> (dictionary *d)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Free all memory associated to an ini dictionary.</em> <a href="#a13"></a><em></em></font><br><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Parser for ini files.<p><p><dl compact><dt><b>Author: </b></dt><dd>N. Devillard </dl><dl compact><dt><b>Date: </b></dt><dd>Mar 2000 </dl><dl compact><dt><b>Version: </b></dt><dd></dl><dl compact><dt><b>Revision: </b></dt><dd> 1.19 </dl><p><hr><h2>Function Documentation</h2><a name="a3" doxytag="iniparser.h::iniparser_dump"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> void iniparser_dump </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>d</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>FILE *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>f</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </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><em>d</em>&nbsp;</td><td>Dictionary to dump. </td></tr><tr><td valign=top><em>f</em>&nbsp;</td><td>Opened file pointer to dump to. </td></tr></table></dl><dl compact><dt><b>Returns :</b></dt><dd>void</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 name="a2" doxytag="iniparser.h::iniparser_dump_ini"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> void iniparser_dump_ini </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>d</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>FILE *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>f</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </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><em>d</em>&nbsp;</td><td>Dictionary to dump </td></tr><tr><td valign=top><em>f</em>&nbsp;</td><td>Opened file pointer to dump to </td></tr></table></dl><dl compact><dt><b>Returns :</b></dt><dd>void</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 name="a11" doxytag="iniparser.h::iniparser_find_entry"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> int iniparser_find_entry </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>ini</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>char *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>entry</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </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><em>ini</em>&nbsp;</td><td>Dictionary to search </td></tr><tr><td valign=top><em>entry</em>&nbsp;</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</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 name="a13" doxytag="iniparser.h::iniparser_freedict"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> void iniparser_freedict </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>d</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </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><em>d</em>&nbsp;</td><td>Dictionary to free </td></tr></table></dl><dl compact><dt><b>Returns :</b></dt><dd>void</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 name="a8" doxytag="iniparser.h::iniparser_getboolean"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> int iniparser_getboolean </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>d</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>char *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>key</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>int&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>notfound</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </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><em>d</em>&nbsp;</td><td>Dictionary to search </td></tr><tr><td valign=top><em>key</em>&nbsp;</td><td>Key string to look for </td></tr><tr><td valign=top><em>notfound</em>&nbsp;</td><td>Value to return in case of error </td></tr></table></dl><dl compact><dt><b>Returns :</b></dt><dd>integer</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>A string starting with 'Y'<li>A string starting with 't'<li>A string starting with 'T'<li>A string starting with '1'</ul>A false boolean is found if one of the following is matched:<p><ul><li>A string starting with 'n'<li>A string starting with 'N'<li>A string starting with 'f'<li>A string starting with 'F'<li>A string starting with '0'</ul>The notfound value returned if no boolean is identified, does not necessarily have to be 0 or 1.     </td>  </tr></table><a name="a7" doxytag="iniparser.h::iniparser_getdouble"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> double iniparser_getdouble </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>d</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>char *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>key</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>double&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>notfound</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </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><em>d</em>&nbsp;</td><td>Dictionary to search </td></tr><tr><td valign=top><em>key</em>&nbsp;</td><td>Key string to look for </td></tr><tr><td valign=top><em>notfound</em>&nbsp;</td><td>Value to return in case of error </td></tr></table></dl><dl compact><dt><b>Returns :</b></dt><dd>double</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 name="a6" doxytag="iniparser.h::iniparser_getint"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> int iniparser_getint </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>d</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>char *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>key</em>, </td>        </tr>        <tr>          <td></td>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -