inifile.h

来自「3D赛车游戏源代码-用Visual Studio 2005」· C头文件 代码 · 共 38 行

H
38
字号
//////////////////////////////////////////////////////////////////////////
//  CIniFile类,文件读取类,打开ini文件并获取文件的信息。
//
//  IniFile.h: CIniFile类的声明
//
//  Copy Rights Wonderful 2006
//////////////////////////////////////////////////////////////////////////

#ifndef __INIFILE_H_INCLUDED__
#define __INIFILE_H_INCLUDED__

//-------------------------------------------------------------------------------
// ini文件读取类
//-------------------------------------------------------------------------------
class CIniFile
{
public:
	// 构造函数
	CIniFile();

	// 打开ini文件(设置路径)
	bool                    Open(const char *filename);
	// 检查section(节)是否存在
	bool                    SectionExist(const char *section);
	// 读取指定section下key的value(字符串)
	const char *            ReadString(const char *section, const char *key, const char *defaultvalue);
	// 设置指定section下key的value(字符串),不存在则创建
	bool                    WriteString(const char *section, const char *key, const char *value);
	// 删除指定section下的key及其value
	bool                    DeleteKey(const char *section, const char *key);
	// 删除指定section及其所有的key及value
	bool                    DeleteSection(const char *section);

protected:
	char                    m_szFileName[128];		// 文件名
};

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?