Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

line breaks

jand1
Beginner
1,003 Views
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

RECL=1024

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
0 Kudos
3 Replies
Steven_L_Intel1
Employee
1,003 Views
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.
0 Kudos
rudi-gaelzer
New Contributor I
1,003 Views
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 13.0.0.079 Build 2012073) ... USE IFPORT logical :; tesva ... tesva= setenvqq("FORT_FMT_RECL=100") write(*,*)z ... 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?
0 Kudos
jimdempseyatthecove
Honored Contributor III
1,003 Views
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
0 Kudos
Reply