Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

print long string to output file without any break

751 views
Skip to first unread message

arun

unread,
Feb 6, 2010, 5:16:16 AM2/6/10
to

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

glen herrmannsfeldt

unread,
Feb 6, 2010, 6:17:40 AM2/6/10
to
arun <arunku...@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

e p chandler

unread,
Feb 6, 2010, 2:11:41 PM2/6/10
to

"glen herrmannsfeldt" <g...@ugcs.caltech.edu> wrote in message
news:hkjj4k$se9$2...@naig.caltech.edu...

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


0 new messages