Output formatting: too much whitespace in gfortran

List-directed IO, i.e, write (*, *) is meant as a convenience. There are no settings to change its behavior. Different compilers will produce different output. Instead you can, as you have identified, use formatted IO. In this case you can use I0 as the format, which will produce the required number of digits, while I1 will only output single-digit integers. Which is OK if those are the largest values that will be output.

WRITE(*,  '( "integer i is ", I0, ", and j is ", I0, "." )' )  i, j

Leave a Comment