Path: utzoo!attcan!uunet!ogicse!milton!whit From: whit@milton.u.washington.edu (John Whitmore) Newsgroups: comp.lang.fortran Subject: Re: WRITE don't do that too me! Summary: 'Newline' terminates only FORMATTED file records. Keywords: WRITE NEWLINE Message-ID: <7396@milton.u.washington.edu> Date: 12 Sep 90 01:08:38 GMT References: Distribution: comp Organization: University of Washington, Seattle Lines: 34 In article quan@sol.surv.utas.oz (Stephen Quan) writes: > >Essentially, I am looking for the putchar(x) C-equivalent where x may be any >character. I got close using (if I recall correctly) : > >eg. putchar(27) is almost : > INTEGER I > CHARACTER X > EQUIVALENCE (I,X) > X = 27 > WRITE (*,100) X >100 FORMAT(A1) > >However, this isn't quite the same as putchar(c) because the WRITE command >also adds a NEWLINE character, how can I suppress the NEWLINE character? Using '*' output unit means you have to accept the FORM='FORMATTED' nature of its implicit OPEN statement; if instead you OPEN explicitly OPEN(UNIT=NGRAPH, FORM='UNFORMATTED'...) it should be just as easy to WRITE(NGRAPH) CHAR(27) as to do the C-equivalent 'putchar(27)'. I prefer to use the CHAR function, as it might be difficult to EQUIVALENCE character with other data types (i.e. generally impossible). As nearly as I can determine, unformatted output does NOT add any or ; you might run into some other record terminations, though, and the OPEN might have to be given some machine-dependent guidance in order to route the output to 'standard output'. John Whitmore