[SOLVED]How to write values in a existing .ini file
-
From the "documentation":http://qt-project.org/doc/qt-5/QSettings.html
[quote]QSettings stores settings. Each setting consists of a QString that specifies the setting's name (the key) and a QVariant that stores the data associated with the key. To write a setting, use setValue(). For example:
[/quote]
Description for "setValue":http://qt-project.org/doc/qt-5/qsettings.html#setValue -
@void Tools_Settings::on_buttonOk_clicked(){
QSettings mySettings = new QSettings("existingIniFile.ini", QSettings::IniFormat);
mySettings->setValue("MainGroup/SubGroup", ui->editMyLineEdit->text());
}@
hope this will help you
If this will solve your problem kingdly edit the titple of the main post with
[SOLVED] -
[quote author="AbdelAli" date="1406102515"]Hello, is there another way to R/W in INI files rather than QSetting ?
thnx[/quote]INI is a very simple text format. In the easiest case, you can simply use QFile + QTextStream and read the file line by line. Or you can use QFile to append additional lines to the INI file. It becomes slightly more complex though, if you actually need to insert lines or modify existing INI file entries...
Yet another way of accessing INI files is using the WritePrivateProfileString and GetPrivateProfileString functions. But those are Windows only.