From: Robin on 27 Jul 2010 13:29 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 27 Jul 2010 16:43 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 27 Jul 2010 22:17 "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 28 Jul 2010 02:18 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 28 Jul 2010 03:23 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
|
Next
|
Last
Pages: 1 2 Prev: When to Declare an External Function as EXTERNAL in a Module ?? Next: solutions books |