Writing data of type QVector<QVector<QString>> into a text file
-
Hi Guys,
I want to write some data into text file.
My data type isQVector<QVector<QString>>table;but I am getting an error
no match for 'operator<<' (operand types are 'QTextStream' and 'QVector<QVector<QString> >')out << table; ~~~~^~~~~~~~~~~~~~How can I write this data to a file?
-
Hi Guys,
I want to write some data into text file.
My data type isQVector<QVector<QString>>table;but I am getting an error
no match for 'operator<<' (operand types are 'QTextStream' and 'QVector<QVector<QString> >')out << table; ~~~~^~~~~~~~~~~~~~How can I write this data to a file?
-
@ashajg The easiest way is to iterate through the lists:
for(const auto &v : table) { for(const auto &str : v) out << str; }I just have to add to @KroMignon, if
tableis notconst, you should useqAsConst:for(const auto &v : qAsConst(table)) { for(const auto &str : v) out << str; }