簡單好用的讀寫ini檔案的類
阿新 • • 發佈:2019-02-13
{
CIniWriter iniWriter(".//Logger.ini");
iniWriter.WriteString("Setting", "Name", "jianxx");
iniWriter.WriteInteger("Setting", "Age", 27);
iniWriter.WriteFloat("Setting", "Height", 1.82f);
iniWriter.WriteBoolean("Setting", "Marriage", false);
CIniReader iniReader(".//Logger.ini");
char*szName = iniReader.ReadString( "Setting", "Name", "");
int iAge = iniReader.ReadInteger("Setting", "Age", 25);
float fltHieght = iniReader.ReadFloat("Setting", "Height", 1.80f);
bool bMarriage = iniReader.ReadBoolean("Setting", "Marriage", true);
std::cout<<"Name:"<<szName<<std::endl
<<"Age:"<< iAge<<std::endl
<<"Height:"<<fltHieght<<std::endl
<<"Marriage:"<<bMarriage<<std::endl;
delete szName;
return1;
}
CIniWriter iniWriter(".//Logger.ini");
iniWriter.WriteString("Setting", "Name", "jianxx");
iniWriter.WriteInteger("Setting", "Age", 27);
iniWriter.WriteFloat("Setting", "Height", 1.82f);
iniWriter.WriteBoolean("Setting", "Marriage", false);
CIniReader iniReader(".//Logger.ini");
char*szName = iniReader.ReadString(
int iAge = iniReader.ReadInteger("Setting", "Age", 25);
float fltHieght = iniReader.ReadFloat("Setting", "Height", 1.80f);
bool bMarriage = iniReader.ReadBoolean("Setting", "Marriage", true);
std::cout<<"Name:"<<szName<<std::endl
<<"Age:"<<
<<"Height:"<<fltHieght<<std::endl
<<"Marriage:"<<bMarriage<<std::endl;
delete szName;
return1;
}