Introduction
ccl is the customizable configuration library, a collection of functions
for application programmers wishing to interface with user-editable
configuration files containing key/value pairs.

ccl is customizable because it allows the comment, key/value, and string
literal delimiters to be programatically specified at runtime.

ccl is designed to be simple and portable; it has a small interface
consisting of five functions and is written in ANSI/ISO C. ccl uses
avl's implemenation of binary search trees for backend storage.

Download
ccl is available via ftp from http://files.sbooth.org/.

Documentation
You can browse the library's contents by using the navigation
bar at the top of this page. A good starting point is the globals page.

Example
An example is the best way to understand how ccl works. A configuration file named example.conf might contain:

## Sample configuration file
Desktop-Picture = /usr/images/earth.jpg
Position = Centered
"Background Color" = Black

The following code demonstrates how to parse and access this file using ccl:

#include "ccl/ccl.h"

struct ccl_t config;
const struct ccl_pair_t *iter; /* Set configuration file details */
config.comment_char = '#';
config.sep_char = '=';
config.str_char = '"'; /* Parse the file */
ccl_parse(&config, "example.conf"); /* Iterate through all key/value pairs */
while((iter = ccl_iterate(&config)) != ) {
printf("(%s,%s)n", iter->key, iter->value);
} /* Clean up */
ccl_release(&config);

When compiled, the snippet above produces the output

(Background Color,Black)
(Desktop-Picture,/usr/images/earth.jpg)
(Position,Centered)

Linux下用C读取配置文件。类似ini这样。的更多相关文章

  1. MySQL入门——Linux下安装后的配置文件

    MySQL入门——Linux下安装后的配置文件 摘要:本文主要了解了在Linux环境下安装MySQL后的配置文件的位置,以及如何创建配置文件. 查看配置文件的加载顺序 找到mysqld的路径 通过wh ...

  2. Linux下的sudo及其配置文件/etc/sudoers的详细配置说明

    http://www.osedu.net/article/linux/2011-01-03/178.html Linux下的sudo及其配置文件/etc/sudoers的详细配置说明 1.sudo介绍 ...

  3. linux下重要的网络配置文件

    linux下重要的网络配置文件:一; /etc/sysconfig/network  文件内容: NETWORKING=yes                                <= ...

  4. linux下如何查找nginx配置文件的位置

    nginx的配置放在nginx.conf文件中,一般我们可以使用以下命令查看服务器中存在的nginx.conf文件. locate nginx.conf /usr/local/etc/nginx/ng ...

  5. python读取配置文件(ini、yaml、xml)

    python读取配置文件(ini.yaml.xml)  

  6. 用python读取配置文件config.ini

    还在学习中...写的有点凌乱 感觉还是应该先学会读取配置文件才行,把一些经常需要修改的但是又经常需要用到的参数放到配置文件中方便使用(我是这么觉得的) 首先是config.ini的存放位置,我们把它放 ...

  7. Python使用ConfigParser模块读取配置文件(config.ini)以及写入配置文件

    前言 使用配置文件来灵活的配置一些参数是一件很常见的事情,配置文件的解析并不复杂,在python里更是如此,在官方发布的库中就包含有做这件事情的库,那就是configParser.configPars ...

  8. Linux下实现视频读取

    V4L(video4linux是一些视频系统,视频软件.音频软件的基础,经常时候在需要采集图像的场合,如视频监控,webcam,可视电话,经常使用在embedded linux中是linux嵌入式开发 ...

  9. Linux下实现视频读取(二)---camera參数设定

    Camera的可设置项极多,V4L2 支持了不少.但Sam之前对这些设置的使用方法和涵义都是在看videodev2.h中边看边理解.感觉很生涩. 直到写这篇blog时,才发现v4l2有专门的SPEC来 ...

随机推荐

  1. 转: Oracle中的物化视图

    物化视图创建语法:CREATE MATERIALIZED VIEW <schema.name>PCTFREE <integer>--存储参数PCTUSED <intege ...

  2. IBatis.Net系列-多参数的SQL语句的配置

    我们在使用IBatis.net操作数据的时候,肯定会碰到SQL参数当我们有一个参数时,IBatis的xml映射文件如下: <statement id="getProduct" ...

  3. [转载]Matrix类的使用

    2013-12-18 11:31:00 转载自: http://www.cnblogs.com/mmy0925/archive/2013/01/22/2871009.html 在Android中,对图 ...

  4. Object Oriented Programming python

    Object Oriented Programming python new concepts of the object oriented programming : class encapsula ...

  5. 【转】CentOS yum安装和卸载软件的使用方法

    在CentOS yum安装和卸载软件的使用方法安装方法安装一个软件时.   CentOS yum -y install httpd安装多个相类似的软件时   CentOS yum -y install ...

  6. 纯JS文本在线HTML编辑器KindEditor

    KindEditor(http://www.kindsoft.net)是一款比较专业,主流,好用的在线HTML编辑器. 它除了可以将文本进行编辑.将Word中的内容复制进来外,本身还可以拖动缩放(右下 ...

  7. yeild

    正在使用cpu的线程,退出,返回等待池,其他优先级相同的线程竞争上岗.

  8. Android布局— — —线性布局

    以水平或垂直的方式显示界面中的控件 线性布局 语法格式: <LinearLayout xmlns:android="http://schemas.android.com/apk/res ...

  9. poj2392 多重背包

    //Accepted 868 KB 188 ms //多重背包 #include <cstdio> #include <cstring> #include <iostre ...

  10. PAT 10-1 在字符串中查找指定字符

    百度了一下另外两位同学的做法,都是先判断是否匹配,然后再用一个for()循环输出,我当然也是先判断,然后,就直接puts(),还是巧妙一点,题设要求及代码实现如下 /* Name: Copyright ...