This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Inconsitancies with 'INQUIRE'
Hi!
Erm... Sorry about that, I must have done something wrong before, now I
cannot reproduce it anymore: I now get the expected:
T YES YES
Filename:Test.txt:
/USER/philippe/Linux/Trial_And_Error/Fortran/GFortran/Inquire_ASCII
-rw-r----- 1 philippe mikrosim 1957 Oct 24 10:26 Test.txt
Test.txt: ASCII English text
Thanks a lot for pointing the right direction: my 'original' (i.e.:
not-reduced) problem (i.e.: reporting wrong for 'FORMATTED') can be
worked around by opening the file first.
Sorry about the wrong report, thanks a lot for helping me!
Philippe
Tobias Burnus wrote:
>
> Hi,
>
> Philippe Schaffnit schrieb:
> > I get: 'F NO UNKNOWN'
> >
> Well, the output is ok, if the file does not exists. Could you re-check
> that the file indeed exists?
>
> > I do not object to getting 'UNKNOWN', but I consistantly get that my
> > files are unreadable and unformatted in the unreduced code...
> >
> Can you add a
> write(*,'(3a)') 'Filename:',trim(filename),':'
> call system('pwd')
> call system('ls -l '//filename)
> call system('file '//filename)
> into the code just before or after the inquire? Only to make sure that
> the file indeed exists, has the assumed permissions, and that you
> inquire the file you want to check. I'm also curious what "file" prints:
> "empty", "data" or "ASCII text" or ...?
>
> I find it very surprising that you get formatted == "NO" as I get
> "YES" even for unformatted files.
>
> > This would be too un-reliable to use, then?
> >
> So far I found that gfortran's return value for "read" and "write" are
> ok, but ifort and NAG f95 do write always "UNKNOWN" unless the file is
> already corrected.
> Thus I regard the "write" and "read" checks as useless and only use the
> "exist" check.
>
> * * *
>
> I fail to create a test case, which shows your problem. As said, I only
> found problems with formatted (filled as bug 29578):
>
> The formatted check returns always "YES" unless the file does not exists
> ("UNKNOWN"). This is specially true for:
> - if the file is unformatted (even if it is still open, that check
> should be trivial) or
> - if the file is not readable.
> In the first case it should be "YES" (at least if opened) or "UNKNOWN"
> (but not if opened),
> in the second case it should be "UNKNOWN".
>
> Tobias