Posts Tagged c

C实现配置文件(Ini文件)读取,跨平台

config.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef __CONFIG_H__
#define __CONFIG_H__
 
#include \"list.h\"
 
typedef struct config_node {
	char *section;
	char *name;
	char *value;
} config_node_t;
 
int config_node_add(list_t *list, char *section, char *name, char *value);
int config_load(list_t **list, const char *filepath);
char *config_get(list_t *list, const char *section, const char *name, const char *def);
void config_free(list_t *list);
 
#endif /* __CONFIG_H__ */

[......]

阅读全文