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. HBase High Level Architecutre

  2. Linux配置防火墙 开启80端口

    vi /etc/sysconfig/iptables -A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT(允许80端口通过防火 ...

  3. 一步步学习JSON

    什么是Json json是JavaScript Object Notation(javascript对象表示法)的缩写,是一种轻量的数据格式,是基于javascript的一个子集.与XML一样,jso ...

  4. 获取Android系统的版本号

    int currentVersion = android.os.Build.VERSION.SDK_INT;

  5. The authenticity of host 192.168.0.xxx can't be established.

    用ssh登录一个机器(换过ip地址),提示输入yes后,屏幕不断出现y,只有按ctrl + c结束 错误是:The authenticity of host 192.168.0.xxx can't b ...

  6. MyEclipse 安装目录下找不到Common目录

    最近在安装了MyEclipse,由于是自己指定的安装目录,在成功安装后要破解的时候却发现找不到安装目录下的Common目录,很是郁闷,后来发现如下: MyEclipse启动后的上方导航中找到MyEcl ...

  7. matlab 解方程组

    1.解方程 最近有多人问如何用matlab解方程组的问题,其实在matlab中解方程组还是很方便的,例如,对于代数方程组Ax=b(A为系数矩阵,非奇异)的求解,MATLAB中有两种方法:(1)x=in ...

  8. golang vim环境搭建

    主要使用到的是golang的vim插件vim-go, 安装方法: (1)配置好自己的GOPATH和GOROOT: (2)在GOPATH目录下建立 src.pkg.main.bin四个目录: (3)安装 ...

  9. postgreSQL9.1忘记postgres用户密码怎么办

    在网络上找了一篇文章http://www.linuxidc.com/Linux/2010-04/25232.htm,如下: Ubuntu 9.10下PostgreSQL 8.4忘记密码的解决方法 Ub ...

  10. 解决办法-错误:Access denied for user 'root'@'localhost' - java

    如下更改密码即可 mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';mysql> FLUS ...