Setting F_UFMTENDIAN envar from within program doesn't invoke conversion

Setting F_UFMTENDIAN envar from within program doesn't invoke conversion

Bild des Benutzers faricelli

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 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers Steve Lionel (Intel)

Are you really using setenv and not getenv?

Steve

Steve
Bild des Benutzers faricelli

Ooops.

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?

John

Bild des Benutzers Steve Lionel (Intel)

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.

Steve

Steve

Melden Sie sich an, um einen Kommentar zu hinterlassen.