hi ChrisW67,
Thanks for your help. It's work.
I really appreciate that 
EDIT:
but one more problem arises:
if my .ini file's content is
[StageNum]
size = 6
0/cy1 = 7
1/cy1 = 2
2/cy1 = 5
3/cy1 = 2
4/cy1 = 3
5/cy1 = 1
[StageNum]
size = 6
0/cy1 = 7
1/cy1 = 2
2/cy1 = 5
3/cy1 = 2
4/cy1 = 3
5/cy1 = 1
To copy to clipboard, switch view to plain text mode
and my code is
int arySize = m4Settings->beginReadArray("StageNum");
for (int vL = 0; vL < arySize; vL ++)
{
m4Settings->setArrayIndex(vL);
cyNum[vL] = m4Settings->value("cy1", 0).toInt();
}
m4Settings->endArray();
int arySize = m4Settings->beginReadArray("StageNum");
for (int vL = 0; vL < arySize; vL ++)
{
m4Settings->setArrayIndex(vL);
cyNum[vL] = m4Settings->value("cy1", 0).toInt();
}
m4Settings->endArray();
To copy to clipboard, switch view to plain text mode
the value of "cyNum" is:
cyNum[0] = 2
cyNum[1] = 5
cyNum[2] = 2
cyNum[3] = 3
cyNum[4] = 1
cyNum[5] = 0
cyNum[0] = 2
cyNum[1] = 5
cyNum[2] = 2
cyNum[3] = 3
cyNum[4] = 1
cyNum[5] = 0
To copy to clipboard, switch view to plain text mode
I have step through the code, when vL = 0, cyNum[0] = 2...
I don't see where my code gets wrong. but why it read the value from second line.
then i tried:
int arySize = m4Settings->beginReadArray("StageNum");
for (int vL = 0; vL < arySize; vL ++)
{
m4Settings->setArrayIndex(vL - 1); // made a little change here
cyNum[vL] = m4Settings->value("cy1", 0).toInt();
}
m4Settings->endArray();
int arySize = m4Settings->beginReadArray("StageNum");
for (int vL = 0; vL < arySize; vL ++)
{
m4Settings->setArrayIndex(vL - 1); // made a little change here
cyNum[vL] = m4Settings->value("cy1", 0).toInt();
}
m4Settings->endArray();
To copy to clipboard, switch view to plain text mode
i got:
cyNum[0] = 2
cyNum[1] = 2
cyNum[2] = 5
cyNum[3] = 2
cyNum[4] = 3
cyNum[5] = 1
cyNum[0] = 2
cyNum[1] = 2
cyNum[2] = 5
cyNum[3] = 2
cyNum[4] = 3
cyNum[5] = 1
To copy to clipboard, switch view to plain text mode
can anyone where i did it wrong, please?
Bookmarks