Qt之Ini文件

ini文件格式

[ 节点 ]=....=

	void OperateXmlIniFile::writeIniFile()
	{
	    QSettings *configIniFile = new QSettings("fileIni.ini", QSettings::IniFormat, this);
	    configIniFile->setValue("ip/first", "address");
	    configIniFile->setValue("ip/second", "127.0.0.1");
	}
	
	void OperateXmlIniFile::readIniFile()
	{
	    QSettings *configIniFile = new QSettings("fileIni.ini", QSettings::IniFormat, this);
	    qDebug() << configIniFile->value("/ip/first").toString();
	    qDebug() << configIniFile->value("ip/second").toString();
	}

ini文件的格式

[info]
first=address
second=127.0.0.1

结果
“address”
“127.0.0.1”

你可能感兴趣的:(QT)