Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!ucbvax!BRL.MIL!jra From: jra@BRL.MIL ("John R. Anderson", VLD/ASB) Newsgroups: comp.sys.sgi Subject: Re: real to character converter Message-ID: <9002240523.aa01589@VAT.BRL.MIL> Date: 24 Feb 90 10:23:01 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 28 From Tom Rohling: > 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'. > > 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. How about something like: character*24 strg real*8 number integer length write( strg , 100 ) number 100 format( 'f10.2' ) c Use a function that returns the index of the last c non-blank character in the string c I'm not sure of the name of the routine length = lnblank( strg ) call fmprstr( ..., strg(1:length) , ... )