Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!ucsfcgl!seibel From: seibel@cgl.ucsf.edu (George Seibel) Newsgroups: comp.sys.sgi Subject: Re: real to character converter Keywords: anybody got a good one? Message-ID: <13170@cgl.ucsf.EDU> Date: 24 Feb 90 23:05:33 GMT References: <3743@uceng.UC.EDU> Sender: daemon@cgl.ucsf.edu Reply-To: seibel@cgl.ucsf.edu (George Seibel) Organization: Computer Graphics Lab, UCSF Lines: 25 In article <3743@uceng.UC.EDU> trohling@uceng.UC.EDU (tom rohling) writes: > > Does anybody have a real good real*8 or real*4 to character converter >subroutine (maybe) that can do the following, (or something like it): > > 1) Send it a real number to be converted to a character variable > that can be forwarded to a graphics lib call like 'fmprstr'. Use an internal write: (it's ANSI f77, not an extension) subroutine RtoCh(rvar,cvar) real rvar character*(*) cvar write(cvar,'(f8.3)') rvar return end > 2) Specify how many decimals you would like to retain. For example, > if I have a real*8, I don't want to have all 16 digits in the > character variable, but say only keep two. For this just use a different format, like f8.2. George Seibel, UCSF seibel@cgl.ucsf.edu