Setting F_UFMTENDIAN envar from within program doesn't invoke conversion

Setting F_UFMTENDIAN envar from within program doesn't invoke conversion

I am experimenting with the endian conversion
feature in the Intel Fortran compiler V7.0.

If I set the F_UFMTENDIAN environmental variable
from the shell to convert unit 10 (say), and then
run a short program to write a few values to a file
unformatted, I can see that the bytes are swapped.

I am trying to get the same effect, but entirely with
a program. I have a small C wrapper routine which
I have used in the past to call C's getenv() routine.
I tried doing a getenv() call just before the open
to the file I want to convert, but the file's contents
are not byte swapped.

Is this possible, or is the F_UFMTENDIAN envar
only looked at once when my program starts up?

John Faricelli

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Are you really using setenv and not getenv?


Retired 12/31/2016


I meant to say that I used a wrapper to C's
*putenv()* function. I don't think IFC's compatibility
library has a putenv() wrapper (most Unix's don't).

I did a putenv() call followed by a getenv() call,
and the F_UFMTENDIAN enviroment variable was set
to "10", the unit I wanted to convert.

Would a code example help?


I looked this up in our support database, and another user recently reported the same thing (case Q166051). Currently, the run-time library looks at the environment variable once only - either when the Fortran main program starts up, or if the main isn't Fortran, on the first I/O.

A change is being implemented that would require you to use SETENVQQ to define the environment variable rather than "putenv", but an update with this change is not yet available. I suggest periodically checking the release notes for new releases available through Premier Support to see when this change is available.


Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today