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

INQUIRE STATEMENT

steve_konarski
初学者
843 次查看
I am uing theINQUIRE statement in a code. if the file exists the EXISTS is returned as .TRUE., however, I have extremely long file names ( including directories) and the combined length is 290 characters. Is this too long ?because say for instance the end of the file name is ..... ABCDEFG_001
then an INQUIRE on ..... ABCDEFG_002 also gives EXISTS as being .TRUE. giving the impression that INQUIRE only works on a set number of characters from the beginning of the filename
The form of the INQUIRE statement is :
INQUIRE (FILE = FNAME, EXIST = EXISTS)
0 项奖励
3 回复数
Steven_L_Intel1
843 次查看
The maximum path length on Windows is 260 characters. I haven't tested to see what happens with longer paths, but I'd expect INQUIRE to complain. Please file a support request with Intel Premier Support.
0 项奖励
Paul_Curtis
重要分销商 I
843 次查看

Here is a Win32 alternative:

FUNCTION file_exists (fname) RESULT (size)

IMPLICIT NONE

TYPE(T_WIN32_FIND_DATA) :: fdata

! fname is full pathname, null-terminated

CHARACTER(LEN=*),INTENT(IN) :: fnameINTEGER :: size, handle, rval

size = -1

handle = FindFirstFile (fname, fdata)

IF (handle /= INVALID_HANDLE_VALUE) THEN

size = fdata%nFileSizeLow

rval = FindClose (handle)

END IF

END FUNCTION file_exists

0 项奖励
jimdempseyatthecove
名誉分销商 III
843 次查看

One of the techniques I have used in the past is to make use of the current working directory. Write a subroutine that:

a) gets and saves the current working on the drive of the pathfilename you are querying on (GETDRIVEQQ)

b) Attempt to set current working directory to a directory in the who's path in the pathfilename you are examining is the longest pathless than 260 characters long.

c) Use INQUIRE on current directory of drive for remainder of pathfilename

d) Restore the current working on the drive

This will get you up to 500 or so characters (assuming Windows doesn't choke).

You can modify this routine to nest deeper if need be.

Jim Dempsey

0 项奖励
回复