mickey
14th September 2006, 00:11
Hi, it happen a weird thing; the first two cout (inside for) print right values: eg -2 -2 1 1 and 1 1 4 4; the second cout print two times the second element: 1 1 4 4 and 1 1 4 4; Why this? thanks..
//list.count() is = 2 in my test case
vector <GLfloat*> ppp;
GLfloat* Pos = new GLfloat[4];
for (uint i=0; i < list.count(); ++i) {
node = list.item(i);
xrett = node.toElement();
QString stringPOS = xrett.attribute("pos");
QStringList values( QStringList::split( ' ', stringPOS ) );
for( uint y = 0; y < values.size(); y++ ) {
Pos[ y ] = values[ y ].toFloat();
cout << "Pos[y] " << Pos[y] << endl;
}
ppp.push_back(Pos);
cout << "PPPPPP " << ppp[i][0] << " " << ppp[i][1] << " " << ppp[i][2] << endl;
}
for (int i=0; i < list.count() ; ++i)
cout << "PPPPPP " << ppp[i][0] << " " << ppp[i][1] << " " << ppp[i][2] << endl;
//list.count() is = 2 in my test case
vector <GLfloat*> ppp;
GLfloat* Pos = new GLfloat[4];
for (uint i=0; i < list.count(); ++i) {
node = list.item(i);
xrett = node.toElement();
QString stringPOS = xrett.attribute("pos");
QStringList values( QStringList::split( ' ', stringPOS ) );
for( uint y = 0; y < values.size(); y++ ) {
Pos[ y ] = values[ y ].toFloat();
cout << "Pos[y] " << Pos[y] << endl;
}
ppp.push_back(Pos);
cout << "PPPPPP " << ppp[i][0] << " " << ppp[i][1] << " " << ppp[i][2] << endl;
}
for (int i=0; i < list.count() ; ++i)
cout << "PPPPPP " << ppp[i][0] << " " << ppp[i][1] << " " << ppp[i][2] << endl;