Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gfortran inquire problem

Status
Not open for further replies.

AlanJT

Programmer
Aug 11, 2020
7
GB
I have recently acquired a new windows 10 PC, As I did on the old one, I have installed gfortran. My latest project includes an INQUIRE call to check for the existence of a directory whose path name has been supplied by the user, so it could have any length. It could also include spaces.

In the past I have simply used something like:
INQUIRE(FILE=TRIM(folder_name), EXIST=existstatus)

which has worked well, with or without spaces.

Now, however,it works well for path names with no spaces, otherwise the system interprets the path name up to the first space, then backs off and loses the last character before the space.

I'm well acquainted with the idea of surrounding the name with either single or double quotes, but that also fails, with EXIST returned as False.

The problem may be compounded by the existence of a gcc compiler bug related to the TRIM function, which recognises the next character AFTER the last one. Similarly LEN_TRIM returns a value one greater than it should.

I even tried copying the supplied path name into a temporary character string, starting and ending with quotes, but that also failed.

I would greatly appreciate any thoughts anyone may be able to offer.

Alan Turk.
 
Which version of gcc/gfortran are you using?
 
Currently using GNU Fortran (GCC) 11.1.0, which I believe is the latest. The version on my old machine was downloaded several years ago, so was probably an earlier version. Unfortunately the PC died (motherboard problem) and I no longer have it so can't check which version I had. I do, however, have the disks from it installed in my new PC, though not as system disks, so someone may be able to tell me how to access the relevant file(s) to determine the version, assuming that is actually possible.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top