I would like to write to the standard output in fortran without adding a line break. That is, I want to do something like this:
a='some string and '
b='some other string'
write(*,101) a
...
write(*,102) b
...
101 format(a,...)
102 format(a)
Is it possible to use some kind of format statement to supress the line break in 101, such that the code outputs "some string and some other string" on the same output line?
Note that it is important that the two write statements are separated, as the code in between is actually used to generate the second string.
You can used the advance='no'
option:
a='some string and '
b='some other string'
write(*,101,advance='no') a
...
write(*,102) b
...
101 format(a)
102 format(a)
This will suppress the linebreak.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With