Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uwm.edu!bionet!ames!skipper!elxsi!maine From: maine@elxsi.dfrf.nasa.gov (Richard Maine) Newsgroups: comp.lang.fortran Subject: Re: avoiding newline after end of WRITE string Message-ID: Date: 2 Feb 90 00:19:21 GMT References: <5588@hydra.gatech.EDU> Sender: news@skipper.dfrf.nasa.gov Organization: NASA Dryden, Edwards, Cal. Lines: 49 In-reply-to: ae219dp@prism.gatech.EDU's message of 1 Feb 90 21:27:30 GMT On 1 Feb 90 21:27:30 GMT, ae219dp@prism.gatech.EDU (Devon Prichard) said: Devon> it's probably way too user-friendly for Fortran, but waht I want Devon> to do is; Devon> WRITE(*, ... ) (' enter number of widgets; ') Devon> READ(*,*) NWIDGET Devon> (where the WRITE format ... means whatever technique is necessary) Devon> in such a way that the terminal does not recieve a newline after Devon> the WRITE statement has been processed. it has to be ANSI standard Devon> Fortran 77 (I know it can be done on HP's and VAXen, but I need it Devon> to be portable). Yer' out of luck if you want it to be ANSI standard (unless you are willing to wait for ANSI Fortran 90 compilers; this is included in the Fortran 90 standard - er, I mean proposed standard). For Fortran 77 it cannot be done while sticking to the standard or even a universally accepted extension. The Vax way (with a '$' format descriptor) works on a lot of systems, but not all. Its probably as close as you can come to a widely adopted way in Fortran 77. Your best bet is to accept the system dependence, but isolate it. Write a subroutine something like: subroutine prompt(msg) character msg*(*) write (*,'(a,$)') msg return end and then call it wherever you need such prompts. This sample, by the way, uses the common (but not universal) $ format descriptor that I mentioned above. This doesn't make your code portable in the sense of being usable unchanged on all systems, but careful isolation of the system dependencies like this can make the code "portable" in the literal sense of the word; it is possible to port it, and it is even relatively easy. Of course, when doing it for "real", you'd include some comments about the system-dependence, mention it in the program documentation, and presumably separate such system-dependent routines into a separate file to make them easy to find. -- Richard Maine maine@elxsi.dfrf.nasa.gov [130.134.64.6]