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

  1. Path: sparky!uunet!pmafire!news.dell.com!swrinde!zaphod.mps.ohio-state.edu!caen!hellgate.utah.edu!lanl!cochiti.lanl.gov!jlg
  2. From: jlg@cochiti.lanl.gov (Jim Giles)
  3. Newsgroups: comp.lang.fortran
  4. Subject: Re: Variable repeat count specifier for FORMAT statments
  5. Message-ID: <1992Jul24.152129.16299@newshost.lanl.gov>
  6. Date: 24 Jul 92 15:21:29 GMT
  7. References: <1992Jul23.215113.16531@jhunix.hcf.jhu.edu> <1992Jul24.012058.21162@ncsa.uiuc.edu>
  8. Sender: news@newshost.lanl.gov
  9. Distribution: na
  10. Organization: Los Alamos National Laboratory
  11. Lines: 23
  12.  
  13. In article <1992Jul24.012058.21162@ncsa.uiuc.edu>, hirchert@ncsa.uiuc.edu (Kurt Hirchert) writes:
  14.  
  15. |> [...]                                            In more complex
  16. |> situations, I would build the format on the fly:
  17. |> 
  18. |>               character*80 fmt
  19. |>               ...
  20. |>               write (fmt,'(a,i3,a)') '(',n,'(I8))'
  21. |>               write (*,fmt) whatever_it_is_you_wanted_to_write
  22.  
  23. Wouldn't it be more legible to write:
  24.  
  25.       character*80 fmt
  26.       ...
  27.       fmt='(nnn(I8))'
  28.       write (fmt(2:4),'(I3)') n
  29.       write (*,fmt) whatever_it_is_you_wanted_to_write
  30.  
  31. There is no need to construct the entire value of `fmt' with the internal
  32. write, you need only concern yourself with that part which changes.
  33.  
  34. -- 
  35. J. Giles
  36.