int i =0;
QStringList list;
list << "uno" << "dos" << "tres";
int size = list.size();
const char *c[size];
foreach(QString s, list)
{
c[i] = s.toLocal8Bit().constData();
i++;
}
cout << endl << "print c-string-array" << endl;
i = 0;
while( i < size)
cout << c[i++] << endl;
Only saves three “tres” in c-string-array.
Ive also tried constructing the c-string-array from an array of QStrings or iterating over QStringlist with an QList::const_iterator, but to no avail.
If i use std::strings however everything works as expected.
Using Qt-5.1.1 on Ubuntu 13.4.
I’d be glad if someone could enlighten me, to what is going on.
↧