-
Notifications
You must be signed in to change notification settings - Fork 3
/
myini.h
36 lines (30 loc) · 1.19 KB
/
myini.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* -*- Mode: C; tab-width: 4; -*- */
/*
* Copyright (C) 2009, HustMoon Studio
*
* 文件名称:myini.h
* 摘 要:读取ini文件+写入ini文件
* 作 者:HustMoon@BYHH
* 修 改:2009.10.8
*/
#ifndef HUSTMOON_MYINI_H
#define HUSTMOON_MYINI_H
#include <stdlib.h> /* for free() */
#ifdef __cplusplus
extern "C"
{
#endif
long loadFile(char **buf, const char *fileName); /* 读取文件 */
long loadFileW(wchar_t**buf, const char *fileName);
int getString(const char *buf, const char *section, const char *key,
const char *defaultValue, char *value, unsigned long size); /* 读取字符串 */
int getStringW(const wchar_t *buf, const wchar_t *section, const wchar_t *key,
const wchar_t *defaultValue, wchar_t *value, unsigned long size);
int getInt(const char *buf, const char *section, const char *key, int defaultValue); /* 读取整数 */
void setString(char **buf, const char *section, const char *key, const char *value); /* 设置字符串,value=NULL则删除key,key=NULL则删除section */
void setInt(char **buf, const char *section, const char *key, int value); /* 设置整数 */
int saveFile(const char *buf, const char *fileName); /* 写入文件 */
#ifdef __cplusplus
};
#endif
#endif