Bertrand Meltz <[log in to unmask]> wrote:
...
>I thought that by having the IOSTAT=error_condition,
>I would detect whether I'm opening a file that does not exist.
>
>Apparently I was wrong.
>
>In my code, I have :
>
>open( unit=...., ..., IOSTAT=error_condition)
>if ( error_condition == 0 )
> ! read the file
> ...
>end if
It is not illegal to open a file that doesn't exist. That's
how new files are created from within Fortran. Have you
tried STATUS='OLD'? That should make the non-existence
of the file an error.
--
J. Giles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|