Output formatting: too many spaces in gfortran

Using gfortran 4.6. This code:

PROGRAM f1
IMPLICIT NONE

INTEGER :: i=1, j=3

WRITE(*,*) "integer i is ", i, ", and j is ", j, "."
END PROGRAM f1

creates this console output that has too many spaces:

 integer i is            1 , and j is            3 .

Is there some kind of setting that I can set so that there is no space before the first token ("integer"), and therefore the spaces between the tokens are just one space? I know that one fix

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

but it seems very cumbersome when I have to do it every time I have a print statement, it will rather be more like C ++, where you explicitly write spaces in the output.

+1
source share
2 answers

IO , write (*, *). . . , , -. I0 , , I1 . , , .

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

    fmt = "(*(1x,g0))"

    write(*,fmt) whatever1, whatever2
0

All Articles