Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!lanl!lambda!ttw From: ttw@lambda.UUCP (Tony Warnock) Newsgroups: comp.lang.misc Subject: Re: Lessons from Algol (Was: JLG's flogging of horses) Summary: Re Fortran list-directed I/O Message-ID: <14358@lambda.UUCP> Date: 4 May 90 19:13:07 GMT References: <1990Apr19.180903.27750@maths.nott.ac.uk> <4277@tukki.jyu.fi> Lines: 41 In article , peter@ficc.uu.net (Peter da Silva) writes: > > With respect to the C statement: > > > printf("The answer is %d, not %d\n", ans, resp) > > > one can use the following Fortran statement > > > write(*,*)' The answer is',ans,' not',resp > > Will this not pad the numbers "ans" and "resp" with spaces? Fortran I/O is > heavily oriented towards columnar output, to the extent that it's all but > impossible to avoid this. > -- > `-_-' Peter da Silva. +1 713 274 5180. > 'U` Have you hugged your wolf today? > @FIN Commercial solicitation *is* accepted by email to this address. Fortran allows both tabulated and free form output. The following program and associated output show the formatting used by the default libraries at Los Alamos. (Your milage may vary.) PROGRAM test(tty,input=tty) IMPLICIT INTEGER (a-z) ans=5 resp=4 WRITE(*,*)' The answer is ',ans,'not ',resp ans=5555555555 resp=4444444444 WRITE(*,*)' The answer is ',ans,'not ',resp END The answer is 5, not 4 The answer is 5555555555, not 4444444444 The Fortran standard allows for either commas or blanks as separators for numerical list-directed output. Character output has no separators.