deepal_de
4th July 2011, 10:19
i need to read all the groups in my ini file... how can i do this?
this is my ini file
[sys_1]
val1 = 10
val2 = 23
val3 = 23
[sys_2]
val1 = 56
val2 = 2
val3 = 27
[sys_3]
val1 = 84
val2 = 65
val3 = 12
this is the code im using
QSettings settings(QDir::currentPath() + "/test.ini", QSettings::IniFormat);
settings.beginGroup("SYS_1");// How to change this to read 'n' number of groups ??
const QStringList childKeys = settings.childKeys();
QStringList Keys;
QStringList values;
foreach (const QString &childKey, childKeys)
{
Keys << childKey;
values << settings.value(childKey).toString();
}
settings.endGroup();
settings.beginGroup("SYS_1");// How to change this to read 'n' number of groups ??
this is my ini file
[sys_1]
val1 = 10
val2 = 23
val3 = 23
[sys_2]
val1 = 56
val2 = 2
val3 = 27
[sys_3]
val1 = 84
val2 = 65
val3 = 12
this is the code im using
QSettings settings(QDir::currentPath() + "/test.ini", QSettings::IniFormat);
settings.beginGroup("SYS_1");// How to change this to read 'n' number of groups ??
const QStringList childKeys = settings.childKeys();
QStringList Keys;
QStringList values;
foreach (const QString &childKey, childKeys)
{
Keys << childKey;
values << settings.value(childKey).toString();
}
settings.endGroup();
settings.beginGroup("SYS_1");// How to change this to read 'n' number of groups ??