Click here to Skip to main content
15,790,884 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hallo , i am trying to wirte csv file using Qt .
the problem is that i have all variables in the same cell , while i want to write each variable in an own cell

What I have tried:

float value1 = 25;
float value2 = 33.2;
float value3 = 38.2;
QFile file("./file.csv");
if (file.open(QFile::WriteOnly|QFile::Truncate))
{
QTextStream stream(&file);
stream <<value1<< "\t"<< value2 <<"\t";
file.close();
Posted
Updated 28-Sep-18 0:23am
v4

1 solution

The format is correct, but you better put the tab in a string. End a line with a return.

In which app was the problem of opening. Try MS Excel or Open Office Calc. Both have an import assistent which may show you the remaining problems.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900