real to character converter
George Seibel
seibel at cgl.ucsf.edu
Sun Feb 25 10:05:33 AEST 1990
In article <3743 at uceng.UC.EDU> trohling at 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 at cgl.ucsf.edu
More information about the Comp.sys.sgi
mailing list