- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oh, it's pretty easy in Fortran, too. You want to call ExpandEnvironmentStrings before you do the OPEN.
Steve
Steve

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page