home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!wupost!cs.utexas.edu!torn!cunews!nrcnet0!cu23.crl.aecl.ca!wl.aecl.ca!harrisp
- From: harrisp@wl.aecl.ca
- Newsgroups: comp.lang.fortran
- Subject: RE: real to string conversion
- Message-ID: <22JUL92.10505201@wl.aecl.ca>
- Date: 22 Jul 92 16:50:52 GMT
- References: <1992Jul22.040204.18446@samba.oit.unc.edu>
- Sender: news@cu23.crl.aecl.ca (USENET News System)
- Organization: AECL RESEARCH
- Lines: 35
- Nntp-Posting-Host: wc4.wl.aecl.ca
-
-
- The standard way to do this is through "internal" files (at least
- on PC's and on VAX mainframes). You use the name of the character variable
- as the file unit, and write to it as though it was a file. I hope the
- following code fragment helps:
-
- character*10 carray
- real*4 val
-
- val=3.1416
- write(carray,1000) val
- 1000 format(f10.4)
- print*,carray
-
-
- The results of executing this code would print
-
- 3.1416
-
- Note that this requires that you are going to know the range of the
- numbers before hand ie. the previous code would print drivel once
- val was greater than 10^6 or less than 10^-4. You could get around this
- using exponential formatting, or runtime formats.
-
- I would imagine there would be something in the index of your fortran
- manual under internal files. If not, check out the area on IO statments,
- specifically WRITE statements
-
-
- hope this helps
-
- Phil Harris | Imagination is more
- Whiteshell Laboratories | important than knowledge.
- Atomic Energy of Canada | Albert Einstein
- HARRISP@WL.AECL.CA |
-