Software Archive
Read-only legacy content
17061 Discussions

Path name substitution in CVF RTL calls

james1
Beginner
624 Views
Is there a method for using symbol substitution when specifying a filename to an RTL routine such as OPEN? For example:

OPEN (file = '%userprofile% eport.log'...

or

OPEN (defaultfile = '%userprofile%' ...

The purpose is to create reasonable symmetry for OPEN calls between the Windows version and other OS versions which allow nice things like logical names in the file specifications.
0 Kudos
3 Replies
Steven_L_Intel1
Employee
624 Views
No - but it's a request we've had before and is on our list of things to consider. I will comment, though, that you're not going to get portability here - the different operating systems have different syntaxes for file specifications. You can define an environment variable for the unit, such as FORT17, and have the RTL use that automatically.

Steve
0 Kudos
james1
Beginner
624 Views
Thanks Steve. We can do this in C and it would be useful to do in Fortran as well. Not so much to be directly portable, but it sure makes string substitution easy. If on one operating system you have:

OPEN (file='logdir:foo.log', ...)

and on the other you have:

OPEN (file='%logdir%foo.log', ... )

then you have a simple string substitution to cross compile. Without this facility, you need to write code to build the filename specification dynamically with additional calls preceding each OPEN.

James
0 Kudos
Steven_L_Intel1
Employee
624 Views
Oh, it's pretty easy in Fortran, too. You want to call ExpandEnvironmentStrings before you do the OPEN.

Steve
0 Kudos
Reply