Thanks manasij I'll bear that in mind.
The other thing is:
I will be saving 3 data files. Each one contains crucial information for re-starting the program from the last save point (incase it gets cut off).
I need either all of them to save or none of them (at each interval). I am thinking now of the specific case when the program is closed down inbetween saves of any of these 3 files.
To try to avoid this I am doing this:
This will minimise the chance of the program closing out inbetween these file saves but it not guaranteed.
file_A.close(); file_B.close(); file_C.close();
Is there anyway to guarantee this without having to save all this info in the same file (as it is much more convenient to have 3 separate files)?