一.交叉编译ini解析库

1.官方网站http://ndevilla.free.fr/iniparser

下载iniparser-3.1.tar.gz

2.解压

tar -zxvf iniparser-3.1.tar.gz
cd tar -zxvf iniparser

3.修改makefile

CC	= gcc  修改为--> CC	= arm-none-linux-gnueabi-gcc
AR = ar 修改为--> AR = arm-none-linux-gnueabi-ar

4.编译

make

5.拷贝src下的头文件dictionary.h和iniparser.h以及压缩包目录下的静态库libiniparser.a和动态库libiniparser.so.0到目标文件系统的对应目录下

二.iniparser库API

int iniparser_getnsec(dictionary * d);	//获取dictionary对象的section个数
char * iniparser_getsecname(dictionary * d, int n); //获取dictionary对象的第n个section的名字
void iniparser_dump_ini(dictionary * d, FILE * f); //保存dictionary对象到file
void iniparser_dumpsection_ini(dictionary * d, char * s, FILE * f); //保存dictionary对象一个section到file
void iniparser_dump(dictionary * d, FILE * f); //保存dictionary对象到file
int iniparser_getsecnkeys(dictionary * d, char * s); //获取dictionary对象某个section下的key个数
char ** iniparser_getseckeys(dictionary * d, char * s); //获取dictionary对象某个section下所有的key
char * iniparser_getstring(dictionary * d, const char * key, char * def); //返回dictionary对象的section:key对应的字串值
int iniparser_getint(dictionary * d, const char * key, int notfound); //返回idictionary对象的section:key对应的整形值
double iniparser_getdouble(dictionary * d, const char * key, double notfound); //返回dictionary对象的section:key对应的双浮点值
int iniparser_getboolean(dictionary * d, const char * key, int notfound); //返回dictionary对象的section:key对应的布尔值
int iniparser_set(dictionary * ini, const char * entry, const char * val); //设置dictionary对象的某个section:key的值
void iniparser_unset(dictionary * ini, const char * entry); //删除dictionary对象中某个section:key
int iniparser_find_entry(dictionary * ini, const char * entry) ; //判断dictionary对象中是否存在某个section:key
dictionary * iniparser_load(const char * ininame); //解析dictionary对象并返回(分配内存)dictionary对象
void iniparser_freedict(dictionary * d); //释放dictionary对象(内存)
unsigned dictionary_hash(const char * key);	//计算关键词的hash值
dictionary * dictionary_new(int size); //创建dictionary对象
void dictionary_del(dictionary * vd); //删除dictionary对象
char * dictionary_get(dictionary * d, const char * key, char * def); //获取dictionary对象的key值
int dictionary_set(dictionary * vd, const char * key, const char * val); //设置dictionary对象的key值
void dictionary_unset(dictionary * d, const char * key); //删除dictionary对象的key值
void dictionary_dump(dictionary * d, FILE * out); //保存dictionary对象

ini文件的格式(dictionary)

[section0]

key0 = value0

key1=value1

[section1]

key0 = value0

key1=value1

ini文件解析c库(iniparser)的更多相关文章

  1. ini文件解析c库(iniparser)【转】

    转自:http://www.cnblogs.com/dyllove98/archive/2013/07/28/3221732.html 一.交叉编译ini解析库 .官方网站http://ndevill ...

  2. 纯C语言INI文件解析

    原地址:http://blog.csdn.net/foruok/article/details/17715969 在一个跨平台( Android .Windows.Linux )项目中配置文件用 IN ...

  3. C++——INI文件详解

    原创声明:本文系博主原创文章,转载及引用请注明出处. 1. INI文件介绍 INI是英文单词 INItialization 的缩写,常作为Windows系统下的配置文件.INI文件是文本文件,通常用于 ...

  4. 解决ini-parser解析ini文件中文乱码问题

    rickyah/ini-parser 是一个.net 平台解析ini文件的库,当ini文件中含有中文字符时会乱码. 解决:将文件通过Editplus 等文本编辑工具保存为 utf-8 + bom 格式 ...

  5. c# 利用动态库DllImport("kernel32")读写ini文件(提供Dmo下载)

    c# 利用动态库DllImport("kernel32")读写ini文件 自从读了设计模式,真的会改变一个程序员的习惯.我觉得嘛,经验也可以从一个人的习惯看得出来,看他的代码编写习 ...

  6. boost::property_tree读取解析ini文件--推荐

    boost::property_tree读取解析ini文件 #include "stdafx.h" #include <iostream> #include <b ...

  7. 实战parse_ini_file()及扩展函数解析ini文件完整版

    文章来源:PHP开发学习门户 地址:http://www.phpthinking.com/archives/587 在PHP站点开发的过程中,往往会用到读取ini參数配置文件,比方须要訪问一些复杂的借 ...

  8. Ajax实现xml文件数据插入数据库(一)--- 构建解析xml文件的js库

    Ajax实现将xml文件数据插入数据库的过程所涉及到的内容比较多,所以对于该过程的讲解本人打算根据交互的过程将其分为三个部分,第一部分为构建解析xml文件的javascript库,第二部分为ajax与 ...

  9. python解析ini文件

    python解析ini文件 使用configparser - Configuration file parser sections() add_section(section) has_section ...

随机推荐

  1. solr集群solrCloud的搭建

    上一章讲了solr单机版的搭建,本章将讲解sole集群的搭建.solr集群的搭建需要使用到zookeeper,搭建参见zookeeper集群的安装 一.solr实例的搭建 1. tomcat安装 这里 ...

  2. UITableView实现分组, 并且点击每个分组后展开

    效果图: 简单说下实现思路: 数据传过来之后, 先创建好对应个数的分组头部View, 也就是要在 - (UIView *)tableView:(UITableView *)tableView view ...

  3. JavaScript 客户端JavaScript之 Web浏览器的环境

    Web浏览器实现的Javascript,通过Web浏览器实现的JavaScript引入了大量可脚本化的对象(1.Web浏览器 2.HTML 3.HTML中的内容)  Web浏览器中的Javascrip ...

  4. JavaScript 客户端JavaScript之 脚本化浏览器窗口

    1.计时器 客户端Javascript以全局函数setTimeOut().clearTimeOut().setInterval().clearInterval()提供这一功能.   前者是从运行的那一 ...

  5. sublime在Mac osx下安装z-codeing(即emmet)

    sublime安装插件可以根据插件名称通过package control就可以很方便的安装好.但是sublime没有默认安装package control,所以我们必须先安装它. 安装package ...

  6. PHPCMS V9二次开发]自定义字段模型-文本组

    phpcms v9,我们在做类似于酒店房型等类型的时候,需要用到文本组字段模型,但phpcms并未提供该模型.如下图所示效果: 展示效果如下: 步骤/方法 打开phpcms\modules\conte ...

  7. php获取汉字首字母

    php获取汉字首字母,可以用于按字母对数据进行检索排序等. 分享下网上找的代码.亲测有效. function getFirstCharter($str){ if(empty($str)){return ...

  8. 无法将类型“System.Nullable`1”强制转换为类型“System.Object”。LINQ to Entities 仅支持强制转换 EDM 基元或枚举类型。

    在一个项目中使用LINQ和EF时出现了题目所示的异常,搜索了很多资料都找不到解决办法,主要是因为EF方面的知识欠缺. 先将情况记录如下,以供以后参考. 查询主要设计两张表,由外键关联: 在进行下面的查 ...

  9. 项目设计&重构&性能优化

    漫谈项目设计&重构&性能优化 重构的好处:重构能够改进软件设计,随着项目需求的变更,项目体积的变大早已与最初的设计大相径庭,代码结构变得凌乱.复杂,如果不进行重构,则很难添加新的功能. ...

  10. Golang http包下FileServer的使用

    FileServer文档:https://godoc.org/net/http#FileServer 今天看到http的 Handle 方法,所以就像试试,就找到FileServer FileServ ...