[HELP]:Problem writing array data to .csv file

Hi all,

Assuming I have create a .csv fil.How can I write new array data to the same .csv file without delete previous data in the file.

my code as below:
1
2
3
4
5
6
   ofstream MyExcelFile;
	MyExcelFile.open("C:\\example.csv");
        for(int i<0; i<10; i++){
	MyExcelFile<< point[i]<<",";
        }
	MyExcelFile.close();


My code manage to write the array data into example.csv file but when i repeat this step to store another array data,the previous one was gone.Can anyone help me how to solve this problem?

Thank you so much.
Last edited on
Look at this: http://www.cplusplus.com/reference/iostream/ofstream/open/

You can provide flags (like app) to the open function like so:

MyExcelFile.open("C:\\example.csv", ofstream::out | ofstream::app);
Thanks for your reply.I have solved the problem.
Topic archived. No new replies allowed.