- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a dummy console application
On the write statement to stdout I get an error, that I can't writ to a file in my users-directory. It seems, that the stadout isn't set to console. What have I to do to make this work, becoause normally I work with conolse applications. With Compaq Fortran this worked.
program test
write ( *,* ) ' hallo'
call exit
end
On the write statement to stdout I get an error, that I can't writ to a file in my users-directory. It seems, that the stadout isn't set to console. What have I to do to make this work, becoause normally I work with conolse applications. With Compaq Fortran this worked.
Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've never seen any problem when trying such a test by compiling from command line. If you are using Visual Studio GUI, possibly you didn't succeed in choosing a console application?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please attach a screenshot of the error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Now I changed my user to be an administrator. Then write (*,* ) writes to the file c:\diocumen....local settings\temp\ramis_fort_print.log. The direcory is not my user-directory. The write (*,*) output is written exactly to this file. When I'm not an administrator, I can't write to this file and get an error.
Then I ichanged the statment ot write ( 6,*) , the filename changed to ramsis_fort6.log.When I look tho the environment, there are 2 variables set, FORT6 and FOR_PRINT which look exactly to these 2 files.
Then I tried write (0,*) and this seems to work. I have to test it onece more, when I have installed version 4. .
PS. Perhaps it has something to dto with the Intel Compiler version 8 which is also installed on my machine.
Then I ichanged the statment ot write ( 6,*) , the filename changed to ramsis_fort6.log.When I look tho the environment, there are 2 variables set, FORT6 and FOR_PRINT which look exactly to these 2 files.
Then I tried write (0,*) and this seems to work. I have to test it onece more, when I have installed version 4. .
PS. Perhaps it has something to dto with the Intel Compiler version 8 which is also installed on my machine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So I tried it with version 4, same result. Write (*,* ) wants to write to a file which is set with the variable FOR_PRINT.
When I code write ( 0,*) then it works.
For reading I have to code read (*,*) this works too.
In my opinion write (*,*) is fortran standard, why does it not work?
When I code write ( 0,*) then it works.
For reading I have to code read (*,*) this works too.
In my opinion write (*,*) is fortran standard, why does it not work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
> ...is Fortran standard, why does it not work?
You have answered this question yourself. The culprit environment variables are not normally set on a Windows system. Someone set them on your system.
As many compilers do, IFort implements several extensions to the Fortran Standard and other features that are requested by users. Among these is redirection of standard I/O to named files using environmental variables. A list of these variables is available in the IFort documentation under Compiler Run-Time Environment Variables.
An earlier installation on your machine has set some of these variables, causing the behavior that you described. Simply remove the culprit SET statements in batch files or using the System_Properties:Advanced:Environment_Variables control panel. Alternatively, set these variables to NULL before running your applications.
You have answered this question yourself. The culprit environment variables are not normally set on a Windows system. Someone set them on your system.
As many compilers do, IFort implements several extensions to the Fortran Standard and other features that are requested by users. Among these is redirection of standard I/O to named files using environmental variables. A list of these variables is available in the IFort documentation under Compiler Run-Time Environment Variables.
An earlier installation on your machine has set some of these variables, causing the behavior that you described. Simply remove the culprit SET statements in batch files or using the System_Properties:Advanced:Environment_Variables control panel. Alternatively, set these variables to NULL before running your applications.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
write(*,*) and read(*,*) are indeed part of the Fortran standard and have been so since at least
FORTRAN 77. What is not part of the standard is what these preconnected units actually represent.
All current operating systems I know allow you to redirect the output to the screen to a file and to
redirect input from the keyboard to a file. This may even be fed to a different program or coming
from a different program. These are features that are completely beyond the control of the compiler.
The environment variables the OP has encountered are yet another way the preconnected units can
be influenced. (I was not aware of these, it is good to know).
Regards,
Arjen
FORTRAN 77. What is not part of the standard is what these preconnected units actually represent.
All current operating systems I know allow you to redirect the output to the screen to a file and to
redirect input from the keyboard to a file. This may even be fed to a different program or coming
from a different program. These are features that are completely beyond the control of the compiler.
The environment variables the OP has encountered are yet another way the preconnected units can
be influenced. (I was not aware of these, it is good to know).
Regards,
Arjen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I deleted the 2 system variables and now it woks. Thanks.

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