This code (compiled with 17 Update 1)
PROGRAM P USE ISO_FORTRAN_ENV IMPLICIT NONE INTEGER :: RECLENGTH INQUIRE(UNIT=OUTPUT_UNIT,RECL=RECLENGTH) WRITE(OUTPUT_UNIT,'(I4)') RECLENGTH WRITE(OUTPUT_UNIT,'(A)') '<------ This character string is exactly 80 characters long, believe me! ------>' WRITE(OUTPUT_UNIT,'(A)') 'Oops!' END PROGRAM P
when run in a console window with a 80-character long line, produces the output:
132 <------ This character string is exactly 80 characters long, believe me! ------> Oops!
Why is there a blank line between the two lines of text?
I don't see that:
D:\Projects>t.exe 132 <------ This character string is exactly 80 characters long, believe me! ------> Oops!
It may be a consequence of the terminal/console detecting that the line was written up to the end of the visible line and therefore inserting a carriage return/line feed.
Yes, it the string is 85 long it will wrap at 80. I am puzzled by the fact that when 80 long it 'wraps' and prints out a blank line. The RECL is also ignored, independently of what the /wrap-margin compiler option is (if the console is wider that 132 characters no wrapping happens).
Arjen may be onto something... I am not sure how to disable this though. It seems that Steve cannot reproduce this.
This is purely cosmetic of course, but a bit disconcerting. I oftentimes output to the console 'delimiter strings' which have the width of the console, to keep the output of my code neat; and now it is inserting a blank line afterwards. Strange.
I don't think it's Intel Fortran doing the wrapping. The options you mention apply to list-directed output only.
The line wrap when text printed hits right margin (80 in this case), followed by anything, even non-advancing character (except maybe back space), will line advance (depending on terminal emulator). This includes CR, LF, CRLF.
This has been with us since the 1980's. Think of it as a "feature".
Windows, in text edit box/window has an equally goofy line advance issue depending on if window has vertical scroll bar and/or boarder design.