其中头文件.h源代码如下:
/************************************************************ FileName: getini.h // 文件名称 Author: yuanfen127 // 作者 Date: 2005-03-31 // 日期 Description: // 描述本文件的内容,功能,内部各部分之间的关系 // 以及文本文件与其它文件关系等 读取指定ini文件中需要在某段中的具体值 Version: 1.0 // 版本信息 Function List: // 主要函数及其功能 1. OpenIniFile 2. CloseIniFile 3. GetIniString 4. CFG_get_key History: // 修改历史记录列表,每条修改记录应包括修改日期、修改 // 者及修改内容简述 1. Date: 2005-03-31 Author: yuanfen127***********************************************************/#ifndef __GETINI_H__ #define __GETINI_H__
/*在下面添加 include */#include <stdio.h>#include <stdlib.h>#include <string.h>
/*C++ 可以直接调用此定义之间的函数*/#ifdef __cplusplus extern "C" {#endif
/*打开文件*/int open_ini_file(const char *pFile);/*关闭文件*/int close_ini_file(void);/*读字符串数据*/int get_ini_string(const char *s_section,const char *s_key, char *s_result);/*取字符串数据*/int cfg_get_key(const char *pFile, const char *s_section, const char *s_key, char *s_val);/*取整型数据*/int cfg_get_int(const char *pFile, const char *s_section, const char *s_key);/*取长整型数据*/long cfg_get_long(const char *pFile, const char *s_section, const char *s_key);/*取实型数据*/double cfg_get_double(const char *pFile, const char *s_section, const char *s_key);
#ifdef __cplusplus }#endif
#endif
