⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inifile.cpp

📁 这是一本学习 window编程的很好的参考教材
💻 CPP
字号:
//---------------------------------------------------------------------------
//
// IniFile.cpp
//
// SUBSYSTEM:   Hook system
//				
// MODULE:      Hook tool    
//				
// DESCRIPTION: Common utilities. 
//              Provides implementation for retrieving data from INI file
// 
//             
// AUTHOR:		Ivo Ivanov (ivopi@hotmail.com)
// DATE:		2001 December v1.00
//
//---------------------------------------------------------------------------

#include "..\Common\Common.h"
#include "..\Common\SysUtils.h"
#include "IniFile.h"

//---------------------------------------------------------------------------
//
// class CIniFile   
//
//---------------------------------------------------------------------------
CIniFile::CIniFile(char* pszFileName)
{
	strcpy(m_szFileName, pszFileName);
}

CIniFile::~CIniFile()
{

}

//
// Retrieve a string value from an INI file
//
void CIniFile::ReadString(
	const char* pszSection, 
	const char* pszIdent, 
	const char* pszDefault,
	char*       pszResult
	)
{
    DWORD dwResult = ::GetPrivateProfileString(
		pszSection,        // section name
		pszIdent,          // key name
		NULL,              // default string
		pszResult,         // destination buffer  
		MAX_PATH,          // size of destination buffer
		m_szFileName       // initialization file name
		);

	if (!dwResult)
		strcpy(pszResult, pszDefault);
}

//
// Retrieve a boolean value from an INI file
//
BOOL CIniFile::ReadBool(
	const char* pszSection, 
	const char* pszIdent, 
	BOOL        bDefault
	)
{
	char    szResult[MAX_PATH];
	BOOL    bResult   = bDefault;
	char    szDefault[MAX_PATH];
		
	BoolToStr(bDefault, szDefault);

	ReadString(
		pszSection, 
		pszIdent,
		szDefault,
		szResult
		);

	bResult = StrToBool(szResult);

	return bResult;
}

//--------------------- End of the file -------------------------------------

⌨️ 快捷键说明

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