c*********************************************************************** SUBROUTINE csv_write_real( lun, value, advance ) ! write a single real to the CSV-file c Auteurs: T.Guillot, P.Morel (adaptation à CESAM2k) Laboratoire Lagrange, OCA c----------------------------------------------------------------- IMPLICIT NONE INTEGER, INTENT(in) :: lun REAL(kind=sp), INTENT(in) :: value LOGICAL, INTENT(in) :: advance CHARACTER(len=40) :: buffer c-------------------------------------------------------- IF (value == 0.e0) THEN WRITE( buffer, '("0.")') ELSE WRITE( buffer, '(G14.6)' ) value ENDIF buffer = adjustl(buffer) IF ( advance ) THEN WRITE(lun,'(a)') trim(buffer) ELSE ! Most probably: write the comma only when needed - depends on other actions WRITE(lun,'(a,a)',advance='no') trim(buffer), ',' ENDIF RETURN END SUBROUTINE csv_write_real