From: Robin on
How can I get fortran, with the print statement to print my output
without a preceding space?

Thank you.
Thanks/
-Robin
From: Ken Fairfield on
On Jul 27, 10:29 am, Robin <rob...(a)cnsp.com> wrote:
> How can I get fortran, with the print statement to print my output
> without a preceding space?

Use an explicit format rather than list directed format.
If that doesn't mean anything to you, either look it
up in a good reference, or search the archives of this
newsgroup for "list directed".

-Ken
From: robin on

"Robin" <robin1(a)cnsp.com> wrote in message news:fc81313b-355d-4fca-9be9-54df586a5e4f(a)y11g2000vbd.googlegroups.com...
| How can I get fortran, with the print statement to print my output
| without a preceding space?

Use a WRITE with an explicit format.


From: Dave Allured on
Robin wrote:
>
> How can I get fortran, with the print statement to print my output
> without a preceding space?

If you really mean just the "print" statement, then this is explicitly
prevented by the Fortran 95 standard. 10.8.2, List-directed output,
last paragraph:

Except for continuation of delimited character
sequences, each output record begins with a blank
character to provide carriage control when the
record is printed.

I expect that the other versions have the same rule. Therefore, do what
Ken and Robin said, use a write statement with an explicit format.

--Dave
From: glen herrmannsfeldt on
Dave Allured <nospom(a)nospom.com> wrote:
(snip)

> If you really mean just the "print" statement, then this is explicitly
> prevented by the Fortran 95 standard. 10.8.2, List-directed output,
> last paragraph:

> Except for continuation of delimited character
> sequences, each output record begins with a blank
> character to provide carriage control when the
> record is printed.

Yes this is the rule for list-directed output, but that has
nothing to do with PRINT vs. WRITE. WRITE can be used for
list-directed output, and PRINT can be used with a FORMAT
statement just fine.

PRINT 1,sqrt(2.0)
1 FORMAT(F8.6)

If you want no leading space you have to carefully select
the w and d, and be careful with negative values.

Strangely, PRINT came in Fortran I, stayed through Fortran II,
but was not included in the Fortran 66 standard. Many compilers
supported it for back compatibility, though. It then came
back, I believe in Fortran 77 but possibly later.

> I expect that the other versions have the same rule. Therefore, do what
> Ken and Robin said, use a write statement with an explicit format.

Or use PRINT with an explicit FORMAT.

-- glen