accessing home directory via ~

Janus Weil jaydub66@googlemail.com
Mon Feb 4 16:12:00 GMT 2008


Dear gfortraners,
I just noticed that it is not possible with gfortran to access the
user's home directory via the '~' character, as done in the following
short program:

program home

implicit none

open(99,file='~/test.dat')

write(99,*) 'hello world!'

close(99)

end program

When I compile this program with a recent 4.3 trunk build, I get the
following error at runtime:

At line 5 of file home.f90 (unit = 99, file = '')
Fortran runtime error: File '~/test.dat' does not exist

I have no idea if the Fortran standard says anything about this, and I
guess it's not really platform independent, but at least under
unix/linux using the '~' for the home directory is a common
convention. And when compiled with ifort this program works as
expected.

So, should I consider this behaviour a bug or a feature of gfortran?
Cheers,
Janus



More information about the Fortran mailing list