您的位置:首页 > 运维架构 > Linux

linux inifile.h

2015-07-17 10:22 441 查看
#ifndef __CONFIG_H__

#define __CONFIG_H__

#include <string>

#include <map>

using namespace std;

class CIniFile

{

public:

CIniFile(const string &strFileName);

~CIniFile(void);

int Dump();

int ReadItem(const string& strSection, const string& strKey, const string& strDefault, string& strValue);

int WriteItem(const string& strSection, const string& strKey, const string& strValue);

private:

int Load();

int Save();

int ReadLine(FILE* pFile, string& strLine);

int TrimString(string& strToken);

private:

static const int BUFFER_LEN = 1024;

string m_strFileName;

typedef map<string, string> ConfigType;

map<string, ConfigType> m_mSec2Config;

};

#endif /* __CONFIG_H__ */
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: