View previous topic :: View next topic |
Author |
Message |
sparge
Joined: 11 Apr 2005 Posts: 371
|
Posted: Thu Oct 12, 2006 8:12 am Post subject: INQUIRE: rules of engagement |
|
|
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. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7926 Location: Salford, UK
|
Posted: Thu Oct 12, 2006 10:13 am Post subject: INQUIRE: rules of engagement |
|
|
Andy
Part of the answer to test if a path exists could be to use ATTACH@ and check the error return. |
|
Back to top |
|
|
sparge
Joined: 11 Apr 2005 Posts: 371
|
Posted: Thu Oct 12, 2006 10:32 am Post subject: INQUIRE: rules of engagement |
|
|
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? |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7926 Location: Salford, UK
|
Posted: Fri Oct 13, 2006 4:42 am Post subject: INQUIRE: rules of engagement |
|
|
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.
|
|
Back to top |
|
|
sparge
Joined: 11 Apr 2005 Posts: 371
|
Posted: Fri Oct 13, 2006 9:04 am Post subject: INQUIRE: rules of engagement |
|
|
Thanks, Paul - I'll check it out. |
|
Back to top |
|
|
sparge
Joined: 11 Apr 2005 Posts: 371
|
Posted: Fri Oct 13, 2006 10:06 am Post subject: INQUIRE: rules of engagement |
|
|
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
|
|
Back to top |
|
|
|