How to open, write data to and close a new file for each step of a loop.
I'm having a problem with a program I'm writing. I'm doing a numerical simulation, and as part of the simulation, I need to output a data file for every timestep, or later output the data of ten timesteps to a data file etc.
The problem is that I would like to be able to vary the filename in each iteration of the loop in a counter fashon.
For example data 1.dat
and so on.
I was wondering if anyone knows a way that this can be accomplished.
All help you can give is very welcome and will be greatly appreciated.