Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

In my program, I output values an .csv file. Now I output the calculated values without any labels: i.e;

In function:-
C++
CString function(double const& val1, double const& val2, double const& val1) 
{
CString str1, str2, str3; 
//Do some calculations and append the values to the strings

return  str1 +  _T("\n") + str2 +  _T("\n") + str3;
}

This gives me the output like:
$101
220m
330m
But I want to out put this with labels in 2 columns:

Id | $101
distance1 | 220m
Distance2 | 330m

(I have used "|" only to replicate a column..)

If I output heading along with values,i.e;
C++
CString heading1 = _T("Id:") ;
return heading1 + str1 + _T("\n")...................

The output is obviously :" Id: $101"
Both are in a single column and is considered to be one string. How can I display them in 2 columns, in a comma separated values(.csv) file?
Posted
Comments
[no name] 22-Aug-12 10:56am    
The "C" in CSV means comma. You seperate your values by using a comma.
Sumal.V 22-Aug-12 11:20am    
I guess this was like using a calculator to calculate 2 + 2! I was completely blank, but yes I had tried earlier but may be I was doing some silly error somewhere :/

Yes instead of _T("\n"), if I use _T(","), I can add labels in different column :) Thanks a lot. :)

1 solution

To get this off the unanswered list, the apparent fix was to use a comma to seperate the values.
 
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