Silverfrost Forums

Welcome to our forums

INQUIRE: rules of engagement

12 Oct 2006 7:12 #1140

As the result of a bout of getting some code working under WinXP that previously ran fine under Win2k, I find myself wondering where the 'rules of engagement' for INQUIRE are to be found. Even 'FORTRAN 90 explained' is less than forthcoming on the subject.

The curiosity started when I (inadvertently) INQUIREd about the existence of a file for which I had provided a file spec that was a blank string. Careless, admittedly - but I think I might have expected to get a simple 'does not exist' response rather than the run-time error I actually got, which declared I had passed an illegal file name. Prompting the question ... how many rules there are to be broken, and what they are.

This got me wondering how much interpretation of the file spec goes on behind the scenes, and where it is documented, and how the statement copes with different OSs. Related to this is whether there is a standard way to INQUIRE about the existence of a path rather than a file. I have been trying the old method of appending '.' to the path I want to enquire about, and it returns false whether the path exists or not. I suspect (but cannot currently demonstrate) that it would have worked under Win9x - in which case, the rules of engagement that I can't find are system-dependent as well.

12 Oct 2006 9:13 #1143

Andy

Part of the answer to test if a path exists could be to use ATTACH@ and check the error return.

12 Oct 2006 9:32 #1144

Hmm. Not used attach@ before - actually,. t seems that fexists@ gives the right answer if supplied with a syntactically valid path (although there's no clear reason to expect this from the documentation).

What about the rules of engagement for INQUIRE, and the run-time error?

13 Oct 2006 3:42 #1145

Andy

If you do not have access to a copy of the Fortran 90 standard, the Fortran 77 standard will probably suffice and can be found at http://www.fortran.com/F77_std/f77_std.html

The runtime error is almost certainly a bug in FTN95.

13 Oct 2006 8:04 #1146

Thanks, Paul - I'll check it out.

13 Oct 2006 9:06 #1148

OK, in one sense the answer's pretty clear. The standard says:

'The value of fin___ must be of a form acceptable to the processor as a file name.'

But that leaves open the question of whether an unacceptable value should be handled by iostat or the runtime library.

Andy

Please login to reply.