May 10, 2013 at 4:10am UTC
How can i save the output of c++ program in cvs file?
I have to this type of data
I have a loop in that i have data of three types and i want to asve it on
cvs file format. Saved data should be some thing like this
id name place gender
1 rita abc female
2 Ali def male
based on loop iteration, data will be iterated and saved in cvs file format.
How can i do that in c++?
Kindly let me know .
thanks
May 10, 2013 at 4:57am UTC
Just output a comma as the separator between each value. At the end of each line, instead of a comma, use an ordinary newline or endl.
May 10, 2013 at 8:32am UTC
Well, you opened the file in append mode, with the ios::app
option.
That's why it appends the new data to the end of the existing file.