In a simple test routine i am curently writing in Fortran90, the string output is longer than the screen. When using the standard write(,) statement, the output in the Instead of simply add a new line and continue on the next line, a second newline is added before continuing the output.
Example code:
write(*,*) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Intel Visual Fortran Composer XE 2013 SP1 output:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Why that is ? Where does this extra newline come from ?
By using list-directed output, which you do with the second *
in the arguments to the write
statement, you surrender precise control of output formatting to the whims of the compiler writers. Seize back control with a specific format, something like write(*,'(a128)')
(replacing 128 with whatever is appropriate for the length of string you want to write). See what happens then.
It might amuse you to learn to use the repeat
function for, well, repetitive strings.