From: arun on

Hi,

I would like to print a long string to the output file without any
line break. The following code fragment breaks the at the middle(say
between 35% - 50% of the line). Can any one suggest a remedy for
this.

n =100 !Fortran 90 code fragment
do i=1, n
write(unit2, *) trim(details(i))
end do

Expecting a reply


with thanks
arun
From: glen herrmannsfeldt on
arun <arunkumar.cr(a)gmail.com> wrote:

> I would like to print a long string to the output file without any
> line break. The following code fragment breaks the at the middle(say
> between 35% - 50% of the line). Can any one suggest a remedy for
> this.

> n =100 !Fortran 90 code fragment
> do i=1, n
> write(unit2, *) trim(details(i))
> end do

List directed output (the * for format) breaks lines in implementation
defined ways. Use A format and it shouldn't break the line.
(Unless there are implementation limits which you exceed.)

> write(unit2,'(A)') trim(details(i))

-- glen
From: e p chandler on

"glen herrmannsfeldt" <gah(a)ugcs.caltech.edu> wrote in message
news:hkjj4k$se9$2(a)naig.caltech.edu...
> arun <arunkumar.cr(a)gmail.com> wrote:
>
>> I would like to print a long string to the output file without any
>> line break. The following code fragment breaks the at the middle(say
>> between 35% - 50% of the line). Can any one suggest a remedy for
>> this.
>
>> n =100 !Fortran 90 code fragment
>> do i=1, n
>> write(unit2, *) trim(details(i))
>> end do
>
> List directed output (the * for format) breaks lines in implementation
> defined ways. Use A format and it shouldn't break the line.
> (Unless there are implementation limits which you exceed.)
>
>> write(unit2,'(A)') trim(details(i))
>
> -- glen

write(unit2,'(A)',advance='no') trim(details(i))

or use an implied DO loop with a sufficiently large repeat count for the A
format

write(unit2,'(999A)') (trim(details(i)),i=1,n)

-- elliot