链接已复制
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
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
