Cruz
19th January 2009, 14:15
I'm not very fit with the QString class. I need to build a string representation of data which is a mixture of text and data. Is there a more elegant way than doing this?
QString string;
QString temp;
QList<float> angles;
string = "data starts here: ";
for (int i = 0; i <angles->size(); i++)
{
temp.sprintf("\t%.2f", angles.at(i));
string.append(temp);
}
And then what's the best way to print this string to stdout? All I know is printf from C and I can't get that to work with Qstring.
Thanks
Cruz
QString string;
QString temp;
QList<float> angles;
string = "data starts here: ";
for (int i = 0; i <angles->size(); i++)
{
temp.sprintf("\t%.2f", angles.at(i));
string.append(temp);
}
And then what's the best way to print this string to stdout? All I know is printf from C and I can't get that to work with Qstring.
Thanks
Cruz