- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the help and clarification, Ronald and Steve!
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page