line breaks

line breaks

Hi, and here another question:

I noticed that standard output (e.g. print* or write(*,*)) gives me line breaks when outputting to stdout or files.

I would like to change the default behaviour of this. I can do something like


in open statements but I'd much rather change the default behaviour since I do not want to change code. I have never noticed this with compilers I used before (mostly Pathscale but also Portland, absoft, etc.). Am I missing something?

Thanks, Jan

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

I suppose what you are missing is that the language provides great freedom for the implementation to start new records in list-directed output. Not only that, but the actual formatting chosen can vary. If you want a specific layout, then use an explicit format. Our compiler starts new lines with the assumption that one is viewing the output on a typical console display with 80-column width.

You can define an environment variable before starting your program, FORT_FMT_RECL, to be the value you want for the default RECL. I recommend against using this, though and suggest that you switch to an explicit format.

Retired 12/31/2016

Regarding this old post, I'm rather puzzled by the unexpected behaviour of list-directed output.
I want to write on the console the value of a quad-precision (REAL*16) complex variable, say z.
As expected, print*, z or write(*,*)z prints out its value in 2 lines, with the record broken after the comma.

Then I tried to modify the list-directed output so that the record is printed on a single line. This is what I did:
(Using Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version Build 2012073)

logical :; tesva
tesva= setenvqq("FORT_FMT_RECL=100")

The output is exactly the same (record broken into 2 lines) regardless if I set the value of FORT_FMT_RECL as 100, 1000 or 10000...

What am I doing wrong here?

The environment variable needs to be set _before_ the program starts.
The record length is captured during the "file" open. stdout (*) is opened prior to your above tesva= setenvqq("FORT_FMT_RECL=100")

Jim Dempsey

Leave a Comment

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