Hi,
there is a QVector<double> in name of "v1". Size of "v1" is 1000. I need to convert all this 1000 elements to QString (or convert to a QStringList) and then save this list into a text file. Please help me in this way.
thanks
Hi,
there is a QVector<double> in name of "v1". Size of "v1" is 1000. I need to convert all this 1000 elements to QString (or convert to a QStringList) and then save this list into a text file. Please help me in this way.
thanks
Read about QString::number
Alex22 (10th February 2016)
If you want to save directly into the file, see QTextStream.
Cheers,
_
Alex22 (10th February 2016)
thanks Lesiok,
I used this:
Qt Code:
for(int y=0; y<v1.size(); y++) { }To copy to clipboard, switch view to plain text mode
how could i save this in a file (text type) in a one column?
Last edited by Alex22; 10th February 2016 at 19:53.
See anda_skoa's post above.
Alex22 (11th February 2016)
Thanks all
I used this and works well:
Qt Code:
QStringList list; for(int y=0; y<v1.size(); y++) { } QFile g1f; g1f.setFileName("test.txt"); { qDebug()<<"can not open to write"; } df << *it << "\n"; g1f.flush(); g1f.close();To copy to clipboard, switch view to plain text mode
is there an optimal way to convert QVector<double> to QStringList? can we do this by QVector::toList()?
The most optimal way is to not create the string list.
Cheers,
_
Bookmarks