This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Strange behaviour with inquire function


On 01/27/2010 11:19 AM, pellegrini wrote:
> On a windows machine, I would like to test whether a network directory
> (e.g. \\MYDIR) exists or not using inquire function withtout using its
> mapping to a given drive letter (that may change from one user of the
> program to another).
>
> Using g95 compiler, inquire(file = '\\MYDIR', exist = exist) works but
> it fails when using gfortran.
> Do you have any idea of what is going wrong ?

The last question is the easiest: "\\MYDIR" ist not a file thus INQUIRE
correctly answers with FALSE; g95 answer also kind of makes sense:
Exists the file-system item? Which can be answered with yes.

The Fortran standard unfortunately does not have the concept of
directories thus there is no support. Thus you need to have either use
wrapper library or to call the API of the operating system. In case of
Windows you could use
http://msdn.microsoft.com/en-us/library/aa273365%28VS.60%29.aspx

Regarding wrapper libraries: Gfortran unfortunately does not include
any, but there are some available such as Posix90, flib's files,
fortranposix (see http://gcc.gnu.org/wiki/GFortranStandards -> POSIX).

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]