CSV file from QT
-
hi
something likeQString filename="c:/Data.txt"; QFile file( filename ); if ( file.open(QIODevice::ReadWrite) ) { QTextStream stream( &file ); stream << name << "," << old << endl; } file.close();
This make only one line in text file so you need a loop where you
take the name, value and write to file from your list or where u have data since
you only show 2 variables. (name, old) -
@khalistan
hi, ok
but CSV file mean COMMA SEPARATED VALUES
and the sample create that.
sikh,600that is a CVS file. !
So you must be more clear of that the output must be.
maybe save one from exec and look in it using editor.EXEL likes to use tab instead of "," sometimes.
But again, the sample can create any type of text output you want but you
must first understand yourself what kind of format you intend to output.When that is clear to you , simple change the line
stream << name << "," << old << endl;
to match that format and you have your file.also just change
String filename="c:/Data.txt";
to
String filename="c:/Data.csv";
if u need that extension..
-
@khalistan
super.
Keine Ursache
:)