Google Groups Home Help | Sign in
WRITE without newline?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  10 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Steven G. Johnson  
View profile
 More options May 26 1998, 3:00 am
Newsgroups: comp.lang.fortran
From: stev...@alum.mit.edu (Steven G. Johnson)
Date: 1998/05/26
Subject: [Q] WRITE without newline?

This is a very simple question I'm sure, but I don't have a Fortran manual
and I need to modify some of our code.

How do you do the equivalent of a WRITE statement without appending a
newline?  I want to do several disjoint WRITE's that output onto the same
line.

Thanks very much for your help!

Cordially,
Steven G. Johnson


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Smulders  
View profile
 More options May 27 1998, 3:00 am
Newsgroups: comp.lang.fortran
From: Peter Smulders <pe...@nvsf2.phys.rug.nl>
Date: 1998/05/27
Subject: Re: [Q] WRITE without newline?

Steven G. Johnson <stev...@alum.mit.edu> wrote:

> This is a very simple question I'm sure, but I don't have a Fortran manual
> and I need to modify some of our code.
> How do you do the equivalent of a WRITE statement without appending a
> newline?  I want to do several disjoint WRITE's that output onto the same
> line.

Don't be too sure! What you want is not a standard ANSI 77 feature,
but a widely available extension is the $ edit descriptor.
Terminating the format specification with a $ causes the cursor
to remain on the same line in such a Fortran.
--
Peter

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Aspden  
View profile
 More options May 27 1998, 3:00 am
Newsgroups: comp.lang.fortran
From: Mike Aspden <m...@nasoftware.co.uk>
Date: 1998/05/27
Subject: Re: [Q] WRITE without newline?

There is a standard Fortran90/95 method of doing it by using
non-advancing IO:

  write(*,"(A)",advance="no") "One "
  write(*,"(A)",advance="no") "two "
  write(*,"(A)") "three"

Note that an explicit format descriptor is needed when using
non-advancing
IO.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oleg Rokach  
View profile
 More options May 27 1998, 3:00 am
Newsgroups: comp.lang.fortran
From: "Oleg Rokach" <rok...@ncac.torun.pl>
Date: 1998/05/27
Subject: Re: [Q] WRITE without newline?

Steven G. Johnson <stev...@alum.mit.edu> wrote in article
<stevenj-ya02408000R2605981723500...@news.mit.edu>...

> This is a very simple question I'm sure, but I don't have a Fortran
manual
> and I need to modify some of our code.

> How do you do the equivalent of a WRITE statement without appending a
> newline?  I want to do several disjoint WRITE's that output onto the same
> line.

> Thanks very much for your help!

> Cordially,
> Steven G. Johnson

C For printing in the same line just use an "+" at the first position in
output list.
C ( this possibility is available since FORTRAN 66 !)
C ----------------
      integer i
      do i = 1, 10000
         write (*,'(A,2x,I5)') '+ Number= ',  i
      enddo
      end

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Juergen von Hagen  
View profile
 More options May 27 1998, 3:00 am
Newsgroups: comp.lang.fortran
From: Juergen von Hagen <vonha...@engr.psu.edu>
Date: 1998/05/27
Subject: Re: [Q] WRITE without newline?

Oleg Rokach wrote:

...
> C For printing in the same line just use an "+" at the first position in
> output list.
> C ( this possibility is available since FORTRAN 66 !)
> C ----------------
>       integer i
>       do i = 1, 10000
>          write (*,'(A,2x,I5)') '+ Number= ',  i
>       enddo
>       end

but then you need probably an output filter like fpr on DEC Unix
machines (exists also on SUN).
out of man fpr:

  ______________________________________________________
  Character        Vertical Space Before Printing
  ______________________________________________________
  Blank            One line
  0                Two lines
  1                To first line of next page
  +                No advance
  $ or ASCII NUL   One line; no return after printing
  ______________________________________________________

cheers
juergen


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ralph Jay Frisbie  
View profile
 More options May 28 1998, 3:00 am
Newsgroups: comp.lang.fortran
From: rfris...@nospam.vcnet.com (Ralph Jay Frisbie)
Date: 1998/05/28
Subject: Re: [Q] WRITE without newline?

On 27 May 1998 16:02:13 GMT, "Oleg Rokach" <rok...@ncac.torun.pl>
wrote:

        Try this, however I've worked with systems where
only the last item written appears, i.e., the screen cursor
returns to column one of the display and thus the new write
overwrites the information already there.  This often happens
so fast it's invisible, so you think the write is wrong.....
                ralph frisbie

Ralph Frisbie
  a saucer lover
      but not the inventor..


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
aryabtsev  
View profile
 More options May 29 1998, 3:00 am
Newsgroups: comp.lang.fortran
From: ARyabt...@my-dejanews.com
Date: 1998/05/29
Subject: Re: [Q] WRITE without newline?

> > How do you do the equivalent of a WRITE statement without appending a
> > newline?  I want to do several disjoint WRITE's that output onto the same
> > line.
> C For printing in the same line just use an "+" at the first position in
> output list.
> C ( this possibility is available since FORTRAN 66 !)
> C ----------------
>       integer i
>       do i = 1, 10000
>          write (*,'(A,2x,I5)') '+ Number= ',  i
>       enddo
>       end

Yes! it'll be print on the same line but from the begining of the line!
I think, the question was how to continue printing on the same line.
It is depend on compiler. For example MS Fortran use back slash format
specify:

      WRITE(*,1000)
1000  FORMAT(' Input value for I - ' \)
      READ(*,*) I

As I remeber some other compiler use '$' instead '\'

 Hope this can help!

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fred Hawes  
View profile
 More options May 29 1998, 3:00 am
Newsgroups: comp.lang.fortran
From: Fred Hawes <fha...@physics.adelaide.edu.au>
Date: 1998/05/29
Subject: Re: [Q] WRITE without newline?

Hi,

I remember that working in Fortran-66, *but* I find it doesn't work
in (the locally available version of) Fortran-77, at least not
for writes to standard input.  Perhaps it only works for file-writes?

The original poster's question was slightly ambiguous.
If what he wants is to do several contiguous writes on the same line,
without overwriting the previous stuff, the way to do it is to end the
formats with a $-sign:

      Num1 = 30
      Num2 = 500

      write(*,'(A,2x,I5,$)') ' First is ',Num1
      write(*,'(A,2x,I5,$)') ' ; Second is ',Num2
      write (*,*)

Regards,
Fred Hawes


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oleg Rokach  
View profile
 More options Jun 1 1998, 3:00 am
Newsgroups: comp.lang.fortran
From: Oleg Rokach <rok...@ncac.torun.pl>
Date: 1998/06/01
Subject: Re: [Q] WRITE without newline?

Hi,

                                                                |
This is working well for DOS/Windows ( MS compilers at least) --|
--
[==========={ Oleg Rokach }=============]        |\      _,,,---,,_
[Nicolaus Copernicus Astronomical Center]  ZZZzz /,`.-'`'    -.  ;-;;,_
[  Rabianska 8, Torun, 87-100, POLAND   ]       |,4-  ) )-,_. ,\ (  `'-'
[       tel. (+48 56) 62 19249          ]      '---''(_/--'  `-'\_)
[       fax. (+48 56) 62 19381          ]
[    http://ncac.torun.pl/~rokach       ]
[========<rok...@ncac.torun.pl>=========]

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
LC's No-Spam Newsreading account  
View profile
 More options Jun 1 1998, 3:00 am
Newsgroups: comp.lang.fortran
From: LC's No-Spam Newsreading account <nos...@ifctr.mi.cnr.it>
Date: 1998/06/01
Subject: Re: [Q] WRITE without newline?

On Fri, 29 May 1998 ARyabt...@my-dejanews.com wrote:

> > > How do you do the equivalent of a WRITE statement without appending a
> > > newline?  I want to do several disjoint WRITE's that output onto the same
> > > line.
> >          write (*,'(A,2x,I5)') '+ Number= ',  i

> Yes! it'll be print on the same line but from the begining of the line!

  The + (1H+ for those who remember Hollerith codes) is a feature intended
  for old printers (and need a print filter to work on modern one), and I
  won't really regret if this one REALLY goes on the OBSOLESCENT or
  OBSOLETE list.

> I think, the question was how to continue printing on the same line.
> It is depend on compiler. For example MS Fortran use back slash format
> 1000  FORMAT(' Input value for I - ' \)

> As I remeber some other compiler use '$' instead '\'

  Most Unix (Sun Ultrix DU=OSF HP-UX) and VMS use $.
  Old HP RTE used underscore

  I believe Fortran 90 has a NOADVANCE option to handle this standardly.

----------------------------------------------------------------------
nos...@ifctr.mi.cnr.it is a newsreading account used by more persons to
avoid unwanted spam. Any mail returning to this address will be rejected.
Users can disclose their e-mail address in the article if they wish so.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google