qini.cpp

来自「BCB下的高效开发包。包含大并发的网络库」· C++ 代码 · 共 46 行

CPP
46
字号
//---------------------------------------------------------------------------
#pragma hdrstop
#include "QINI.h"
#include "QStdlib.h"
#include "Windows.h"
#pragma package(smart_init)
//---------------------------------------------------------------------------
std::string GetConfig(const std::string& Key)
{
        return GetConfig(GetAppPath() + "Config.ini", "CONFIG", Key);
}
//---------------------------------------------------------------------------
std::string GetConfig(const std::string& Tab, const std::string& Key)
{
        return GetConfig(GetAppPath() + "Config.ini", Tab, Key);
}
//---------------------------------------------------------------------------
std::string GetConfig(const std::string& File, const std::string& Tab, const std::string& Key)
{
	char buf[65536];
	int len = ::GetPrivateProfileString(Tab.c_str(), Key.c_str(), "", buf
            ,sizeof(buf), File.c_str());
        return std::string(buf, len);
}
//---------------------------------------------------------------------------
int GetConfigInt(const std::string& Key)
{
        return QStrToInt(GetConfig(Key));
}
//---------------------------------------------------------------------------
bool SetConfig(const std::string& Key, const std::string& Value)
{
        return SetConfig(GetAppPath() + "Config.ini", "CONFIG", Key, Value);
}
//---------------------------------------------------------------------------
bool SetConfig(const std::string& Tab, const std::string& Key, const std::string& Value)
{
        return SetConfig(GetAppPath() + "Config.ini", Tab, Key, Value);
}
//---------------------------------------------------------------------------
bool SetConfig(const std::string& File, const std::string& Tab, const std::string& Key, const std::string& Value)
{
        return ::WritePrivateProfileString(Tab.c_str(), Key.c_str(), Value.c_str(), File.c_str());
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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