My program works with a set of files (several millions). All the files were created earlier with some other code. Some of the files are empty, some have values; all of them have 'OLD' status. My program has to
- open one of the files;
- add some value to the END of THE FILE if the file contains numbers already or just put a first value if the file is empty;
- close the file and go to another file processing.
Right now, if the file is non-empty, the program erase the file's previous content and just write a new value. I think, in order TO ADD a value to the end of existing non-empty file I need to use some clause in OPEN or WRITE statement in addition to the 'OLD' status. Which ones? Thank you.
It would be easier with a MWE, but nonetheless, what you could do is something like that, using the
append
keywordYou could try it on this simple example adapted from the Fortran Wikibook to see how it works