- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have a small question regarding the INQUIRE statement in ifort v.8.0.034. The following code:
PROGRAM TestInquire
! we need this var for the call to INQUIRE
LOGICAL :: bool
! call INQUIRE
INQUIRE(FILE='TestInquire.f',EXIST=bool)
! print the result
IF (bool) THEN
WRITE(*,*) 'The file TestInquire.f seems to exist...'
ELSE
WRITE(*,*) 'The file TestInquire.f doesn''t seem to exist...'
ENDIF
! call INQUIRE
INQUIRE(FILE='.',EXIST=bool)
! print the result
IF (bool) THEN
WRITE(*,*) 'The file ''.'' seems to exist...'
ELSE
WRITE(*,*) 'The file ''.'' doesn''t seem to exist...'
ENDIF
END PROGRAM TestInquire
Produces different results for ifc-7.1:
$ ./a.out
The file TestInquire.f seems to exist...
The file '.' seems to exist...
and ifort-8.0:
$ ./a.out
The file TestInquire.f seems to exist...
The file '.' doesn't seem to exist...
I don't know if this is a bug in INQUIRE, since according to all specifications I've seen it applies to files, but under all other fortrans I know of, this works... Is this a feature that got lost in the re-implementation of the IO-routines? If so, how can I work around it?
Cheers and many thanks in advance,
Pedro
I have a small question regarding the INQUIRE statement in ifort v.8.0.034. The following code:
PROGRAM TestInquire
! we need this var for the call to INQUIRE
LOGICAL :: bool
! call INQUIRE
INQUIRE(FILE='TestInquire.f',EXIST=bool)
! print the result
IF (bool) THEN
WRITE(*,*) 'The file TestInquire.f seems to exist...'
ELSE
WRITE(*,*) 'The file TestInquire.f doesn''t seem to exist...'
ENDIF
! call INQUIRE
INQUIRE(FILE='.',EXIST=bool)
! print the result
IF (bool) THEN
WRITE(*,*) 'The file ''.'' seems to exist...'
ELSE
WRITE(*,*) 'The file ''.'' doesn''t seem to exist...'
ENDIF
END PROGRAM TestInquire
Produces different results for ifc-7.1:
$ ./a.out
The file TestInquire.f seems to exist...
The file '.' seems to exist...
and ifort-8.0:
$ ./a.out
The file TestInquire.f seems to exist...
The file '.' doesn't seem to exist...
I don't know if this is a bug in INQUIRE, since according to all specifications I've seen it applies to files, but under all other fortrans I know of, this works... Is this a feature that got lost in the re-implementation of the IO-routines? If so, how can I work around it?
Cheers and many thanks in advance,
Pedro
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's not a bug, and support of this concept is not as unversal as you think. It comes up for discussion occasionally in comp.lang.fortran. The general thinking is that if you can't OPEN it, you can't INQUIRE about it either, so directories ought not to be supported as subjects in INQUIRE. Some compilers support it, many do not.
I suggest you use some OS-appropriate method to look up directories.

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