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

📄 iniparser_8h.html

📁 一个使用anci c实现的ini处理程序
💻 HTML
📖 第 1 页 / 共 2 页
字号:
          <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 an int.<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.     </td>  </tr></table><a name="a0" doxytag="iniparser.h::iniparser_getnsec"></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_getnsec </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>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><em>d</em>&nbsp;</td><td>Dictionary to examine </td></tr></table></dl><dl compact><dt><b>Returns :</b></dt><dd>int Number of sections found in dictionary</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 name="a1" doxytag="iniparser.h::iniparser_getsecname"></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"> char* iniparser_getsecname </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>int&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>n</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 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><em>d</em>&nbsp;</td><td>Dictionary to examine </td></tr><tr><td valign=top><em>n</em>&nbsp;</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</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 name="a4" doxytag="iniparser.h::iniparser_getstr"></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"> char* iniparser_getstr </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 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, 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><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></table></dl><dl compact><dt><b>Returns :</b></dt><dd>pointer to statically allocated character string, or NULL.</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 name="a5" doxytag="iniparser.h::iniparser_getstring"></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"> char* iniparser_getstring </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>char *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>def</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.<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>def</em>&nbsp;</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</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 name="a12" doxytag="iniparser.h::iniparser_load"></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"> dictionary* iniparser_load </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">char *&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>ininame</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>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><em>ininame</em>&nbsp;</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</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 name="a9" doxytag="iniparser.h::iniparser_setstr"></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_setstr </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></td>          <td class="md" nowrap>char *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>val</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>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><em>ini</em>&nbsp;</td><td>Dictionary to modify. </td></tr><tr><td valign=top><em>entry</em>&nbsp;</td><td>Entry to modify (entry name) </td></tr><tr><td valign=top><em>val</em>&nbsp;</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.</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 name="a10" doxytag="iniparser.h::iniparser_unset"></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_unset </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>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><em>ini</em>&nbsp;</td><td>Dictionary to modify </td></tr><tr><td valign=top><em>entry</em>&nbsp;</td><td>Entry to delete (entry name) </td></tr></table></dl><dl compact><dt><b>Returns :</b></dt><dd>void</dl>If the given entry can be found, it is deleted from the dictionary.     </td>  </tr></table></body></html>

⌨️ 快捷键说明

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