Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

READ keyword on INQUIRE function

paul_romano
Beginner
455 Views
I am trying to determine whether a file is readable using the INQUIRE function (compiling using Intel Fortran Compiler XE 2011.0.084) but the READ keyword always seems to just give me "UNKNOWN" whether or not the file has readable attributes enabled. I'm running on a 32-bit linux machine (Ubuntu). My code is basically:

logical :: file_exists
character(7) :: readable
inquire(FILE=path_input, EXIST=file_exists, READ=readable)

I've confirmed that this works with other compilers. Can anyone shed light on why I might be getting UNKNOWN?

Thanks,
Paul
0 Kudos
1 Solution
Steven_L_Intel1
Employee
455 Views
The approach we take is that we look at the file attributes only if it is open. Given all the mechanisms that operating systems use to determine accessibility, this is the only safe way.

View solution in original post

0 Kudos
3 Replies
Ron_Green
Moderator
455 Views
Paul,

This is interesting - even old compilers give the same behavior, and on other Linux distros too. Seems like a bug. I'll write it up.
0 Kudos
Steven_L_Intel1
Employee
456 Views
The approach we take is that we look at the file attributes only if it is open. Given all the mechanisms that operating systems use to determine accessibility, this is the only safe way.
0 Kudos
paul_romano
Beginner
455 Views
Thanks for the help and clarification, Ronald and Steve!
0 Kudos
Reply