views:

860

answers:

1

Hello,

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.

+2  A: 

Hey,

you can used the "advance='no'" option:

write(*,101,advance='no') a
101 format(a)

This will supress the linebreak.

Karl Yngve Lervåg