📄 inirw.h
字号:
#include "stdafx.h"
#ifndef __INI_FILE_OP__
#define __INI_FILE_OP__
class INIRW
{
public:
INIRW();
INIRW(const char * iFile); //带参数初始化
INIRW::INIRW(const char* iFile, BOOL flag); //如果标志为真,则指定的文件不存在时,自已创建该文件
BOOL SetFileName(const char* iFile); //绑定一个INI文件
BOOL SetFileName(const char* iFile, BOOL flag); //绑定一个INI文件
long GetAllSection(CString& Buf, unsigned int SectionLenth); //传递一个CString 的引用,和希望得到的字段长度总和
long GetAllSection( char *Buf, unsigned int SectionLenth); //如果成功则返回一个整数表示该INI文件包含的字段数,失败则返回-1
//用户要保证有一个足够的缓冲区,以存放(传入缓冲区指针长度,和缓冲区大小)
BOOL DelSection(const char* Section); //删除指定段的所有内容
long ReadKeyValue(const char* Section, const char* Key, CString& Buf); //读出指定键值字符串
long ReadKeyValue(const char* Section, const char* Key); //读出一个整数
BOOL WriteKeyValue(const char* Section, const char* Key, const char* String); //写入一个字符串
BOOL WriteKeyValue(const char* Section, const char* Key, long Value); //写入一个整数值
const char* GetIniFileName(void); //返回当前绑定的INI文件的名字
private:
CString iniFile;
BOOL FileExists(const char* filename); //测试文件是否存在
protected:
BOOL initFlag; //如果没有设置文件,则值为FALSE ,否测为TRUE
virtual void InitFile(void);//初始化INI文件,创建段和写入内容,可重载
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -