home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / fortran / 2887 < prev    next >
Encoding:
Internet Message Format  |  1992-07-30  |  1.2 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!unixhub!slacvx.slac.stanford.edu!fairfield
  2. From: fairfield@slacvx.slac.stanford.edu
  3. Newsgroups: comp.lang.fortran
  4. Subject: Re: Assigning numeric variables to strings
  5. Message-ID: <1992Jul30.105946.1@slacvx.slac.stanford.edu>
  6. Date: 30 Jul 92 18:59:46 GMT
  7. References: <Bs7qD3.F70@news.cso.uiuc.edu>
  8. Sender: news@unixhub.SLAC.Stanford.EDU
  9. Organization: Stanford Linear Accelerator Center
  10. Lines: 18
  11. Nntp-Posting-Host: slacvx.slac.stanford.edu
  12.  
  13. In article <Bs7qD3.F70@news.cso.uiuc.edu>, jal41820@uxa.cso.uiuc.edu (Smiley) writes:
  14. > How can one assign a numeric variable to part of a string (e.g., if 
  15. > fortran allowed this statement, string(38:39) = int(real) is what I
  16. > want to do)?
  17.  
  18.     Use an "internal write" to the string, e.g.,
  19.  
  20.     WRITE (STRING(38:39), '(I2)') INT(XX)
  21.  
  22. where XX is your REAL variable.
  23.  
  24. -- 
  25.  Dr. Kenneth H. Fairfield    |  Internet: Fairfield@Slacvx.Slac.Stanford.Edu
  26.  SLAC, P.O.Box 4349, MS 98   |  DECnet:   45537::FAIRFIELD (45537=SLACVX)
  27.  Stanford, CA   94309        |  BITNET    Fairfield@Slacvx
  28.  ----------------------------------------------------------------------------
  29.  These opinions are mine, not SLAC's, Stanford's, nor the DOE's...
  30.