📄 cinifile.h
字号:
#include <windows.h>
#include <iostream>
#include <TCHAR.h>
#include <vector>
using namespace std;
#pragma warning(disable:4786)
typedef vector<string> stringArray;
class CIniFile
{
public:
CIniFile();
virtual ~CIniFile();
// 设置ini文件路径
// 成功返回TRUE;否则返回FALSE
bool SetPath(string strPath);
// 检查section是否存在
// 存在返回TRUE;否则返回FALSE
bool SectionExist(string strSection);
// 从指定的Section和Key读取KeyValue
// 返回KeyValue
string GetKeyValue(string strSection , string strKey);
// 设置Section、Key以及KeyValue,若Section或者Key不存在则创建
void SetKeyValue(string strSection, string strKey, string strKeyValue);
// 删除指定Section下的一个Key
void DeleteKey(string strSection, string strKey);
// 删除指定的Section以及其下的所有Key
void DeleteSection(string strSection);
// 获得所有的Section
// 返回Section数目
int GetAllSections(stringArray& strArrSection);
// 根据指定Section得到其下的所有Key和KeyValue
// 返回Key的数目
int GetAllKeysAndValues(string strSection,
stringArray& strArrKey,
stringArray& strArrKeyValue);
// 删除所有Section
void DeleteAllSections();
private:
// ini文件路径
string m_strPath;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -