Print

Print


Dan Kidger wrote:

> You can do what you want in a portable way by using Fortran's '/' edit
> descriptor. The trick is to build up your output line as a format descriptor
> string and *not* as the target of an '(a)' edit descriptor.
>
> eg.
>    program multiline
>    !      This demonstrates how to have multiline outputs
>    character :: mystring*79
>    write (mystring,'(3a)')   &
>   &  '("this is on one line"',',/,','"and this on the next")'
>    print*,mystring
>    write (*,mystring)
>    end

I wrote that it doesn't work.

Malcolm pointed out that it _does_ work.  I tried it, and sure
enough it doesn't crash, and puts the text on two different lines.

I think, however, that it doesn't do what Catherine wanted done.
My experience with people who design HDF files with text arrays
in them used for metadata is that they expect one giant string
of text, with \n embedded where the line breaks ought to be,
with variable-length "lines," and maybe with \0 at the "end."
I.e., they are only able to think in C.

This is different from putting multi-line output into a file.

So if Catherine wants what I think she wants, Kidger's solution
won't do it (although Kidger's program "works").

--
What fraction of Americans believe   |  Van Snyder
Wrestling is real and NASA is fake?  |  [log in to unmask]
Any alleged opinions are my own and have not been approved or disapproved
by JPL, CalTech, NASA, Dan Goldin, George Bush, the Pope, or anybody else.