ini配置文件读写(大华)

以下代码来自大华工程师所写,代码摘自大华工业相机sdk

代码很简洁,也有很多注释,所以分享出来:

来看头文件:

// Cfg.h: interface for the CCfg class.
//

// 功能描述:配置功能,一般根据读取配置决定是否显示某配置项;
// Function Description: configuration function. Generally, whether to display a configuration item depends on the read configuration;



#if !defined(CONFIG)
#define CONFIG

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


class CConfig
{
	typedef enum
	{
		MAX_VALUE_LEN = 300,		//< 每个键值最大长度  | maximum length per key
	}ENUM_LIMIT;

public:
	//! 构造、析构函数
	// construct、destructor function
	CConfig();
	CConfig(CString strFile);
	virtual ~CConfig();

	// 设置配置文件路径
	// Set configuration path
	void SetCfgFile(CString strFile);

	// 获取配置文件路径
	// get configuration file path

	CString GetCfgFile();

	// 获取键值						| get key value
	// 参数列表:	appName	app名称 | parameters list : application name
	// keySource	子键名称        | subkey 

你可能感兴趣的:(c++开发实战源码,ini配置文件读写,vc,ini配置文件读写,windows,配置文件读写)