CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   fortran (https://www.cfd-online.com/Forums/main/5282-fortran.html)

moh October 16, 2002 07:42

fortran
 
hi could any one describe for me how can i append two data file.for example in my restart code i want data of restart program dont over right on the last data thanks

Rob October 16, 2002 10:06

Re: fortran
 
This can be compiler dependent but I have generally found the following successful for a number of fortran 77 and 90 compilers:

Suppose you have a file called data.dat which is not empty.

If you simply use open(**,file='data.dat') , where ** is your reference number to the file, and then write to the file all old data will be overwritten.

To overcome this problem modify the open statement to read open(**,file='data.dat',ACCESS='APPEND') where ** is as before. Your old data should now be safe and the new data will follow it.

Hope this works

Rob

newcomer October 17, 2002 05:52

Re: fortran
 
A caution - in the very beginning you should once open the file (not append access) and close the same. Otherwise you get a huge appended file. Your case is for restart.


All times are GMT -4. The time now is 04:44.