Question

I would like to know what is the different between this statement:

open(unit=11,file="something.TXT",status="unknown"), which is Fortran's default status (i.e., the previous statement is the same as open(unit=11,file="something.TXT")

and this statement:

open(unit=11,file="something.TXT",status="replace")

I have the impression that the unknown status behave exactly as I would expect with replace: if the file doesn't exist, it creates it. If it does exist, then it replaces it.

Was it helpful?

Solution

The Fortran standard lays down that the interpretation of status='unknown' is processor-dependent. That is, your impression is subtly incorrect.

In the draft of the 1995 standard I have at hand this is explained in section 9.3.4.2.

In the draft of the 2003 standard I have at hand this is explained in section 9.4.5.15.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top