real to character converter

"John R. Anderson", VLD/ASB jra at BRL.MIL
Sat Feb 24 21:23:01 AEST 1990


>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) , ... )



More information about the Comp.sys.sgi mailing list