Re: WRITE + new line



Hello,

glen herrmannsfeldt wrote:
Dan Nagle wrote:

<snip>

Actually, no.  List-directed formatting, as indicated
by the second * in the write statement, allows the processor
to start new lines at will.  Richard has explained this
very well earlier in this thread.


It should still start a new line for each row.

I don't see, off hand, where in 10.9.2 this is required. I may have missed it, I suppose, but it's not that large a section. Most of the discussion there concerns allowed formats and separators. Usually, transfers are processed in term of effective list items. In this case, the effective list item is the array element, IIRC.

And I admit I haven't checked a lot of compiler to see
what the usual practice is.

It may start a new line in other places, too. I would be pretty surprised if it started a new
line for each element, though maybe for COMPLEX*32 I wouldn't be so
surprised. In any case, yes, it is allowed to do that.

Well, OK, but the OP asked

Martin Glaser wrote:

Hi,

I want to write an 2-dimensional array to a textfile, but WRITE always uses a new line. How can you stop that?

which I take to mean that he has too many new lines, not a shortage.

In any case, Robin's answer was, at best, incomplete.
Yet it was offered in his usual highly-confident tone.

I still think Richard gave the most complete answer.
And a reading of section 10.9.2 on list-directed output
is the authoritative source.

But sometimes the "standards-hat" is a bit tight, and I try
to provide advice which is highly portable.  "Just happening"
to work on one or a few compiler(s) is not always guaranteed
to be helpful with the next compiler.

--
Cheers!

Dan Nagle
Purple Sage Computing Solutions, Inc.
.



Relevant Pages

  • Re: gfortran and "Type/rank mismatch"
    ... compiled on some compiler that didn't catch the error. ... I only use this subroutine to call a C function ... What Richard and Craig have told you is that two declarations ... "Declaration #2" below look the same a compiler is free ...
    (comp.lang.fortran)
  • Re: grown defect list?
    ... >Richard W. Könning schrieb: ... Stimmt, u.a. in der Readme.txt stand noch was von 5.0, der Compiler ... Prev by Date: ... Next by Date: ...
    (de.comp.hardware.laufwerke.festplatten)
  • Re: Pointers to char pointers in functions
    ... Many thanks for the response Richard. ... cast's for malloc unless the compiler complains (I generally use MS's ... Now the memory I allocate in fmust be assigned to a char* ...
    (comp.lang.c)
  • Re: Opinions on PGI vs. Lahey Fortran
    ... Richard E Maine wrote: ... > I have no experience with parallelization with either compiler, ... PGI just for the heck of it to see what I may be missing. ...
    (comp.lang.fortran)
  • Re: Date manipulation
    ... >> By having a little bit of smarts. ... Richard, that brings up a thought, relative to the OO threads now ongoing. ... In one case the compiler ... it is the ramifications of the concept that I'm ...
    (comp.lang.cobol)