Question: writing vectors to file

I am solving a dynamic problem however due to the complexity of the problem, the software runs out of memory. To avoid the memory los i am tring to write each time step solution into a text file however in order to do that i need to open a file using "fopen"

unfortunately this command enables writing to a file only if followed by "fclose" yet if the program stack before the file is closed the data is lost. on the other hand if i close the file after every time step the new file overrides the old one

My question: Is there a way of adding data to a file without overriding the existing data?

Please Wait...