- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't see that:
D:\Projects>t.exe 132 <------ This character string is exactly 80 characters long, believe me! ------> Oops!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So if you 80 char string is 85 long it it wrapping at 80?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't think it's Intel Fortran doing the wrapping. The options you mention apply to list-directed output only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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".
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BTW
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.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can set and control console attributes using windows api routines but some work is involved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks to all for the answers - yes, it looks as if this is a Windows console behavior that cannot be controlled "easily" from my code.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page