home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / fortran / 4331 < prev    next >
Encoding:
Text File  |  1992-11-17  |  1.6 KB  |  48 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!agate!spool.mu.edu!uwm.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!uimrl7.mrl.uiuc.edu!ercolessi
  3. From: ercolessi@uimrl4.mrl.uiuc.edu (furio ercolessi)
  4. Subject: Re: Print characters on one line without newline...???
  5. References:  <BxtnK6.23s@cs.uiuc.edu>
  6. Message-ID: <Bxtr38.8p9@news.cso.uiuc.edu>
  7. Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
  8. Reply-To: ercolessi@uimrl4.mrl.uiuc.edu (furio ercolessi)
  9. Organization: MRL - UIUC
  10. Date: Mon, 16 Nov 1992 19:49:53 GMT
  11. Lines: 35
  12.  
  13. In article <BxtnK6.23s@cs.uiuc.edu>, ctaylor@cs.uiuc.edu (Conrad W Taylor) writes:
  14. |>         I'm writting this PrintX routine that is to print
  15. |>the letter X n times on one line without any spaces and
  16. |>newline.  My PrintX routine looks like this:
  17. |> [...]
  18. |>
  19. |>This routine only prints one 'X' on n lines and I want it to print
  20. |>n X's on one line without any spaces in between and without a new-
  21. |>line character.  Could someone explain what I might be doing wrong?
  22.  
  23. I do not think this can be done using standard Fortran.
  24. Many compilers, however, offer a FORMAT extension usually
  25. called $ which allows this, and works as follows:
  26.  
  27.       SUBROUTINE PrintX(XCOUNT)
  28.         INTEGER XCOUNT
  29.  
  30.         INTEGER i
  31.  
  32.         DO 10 i=1, XCOUNT
  33.           PRINT 20
  34.   10    CONTINUE
  35.   20    FORMAT($, 'X')
  36.  
  37.         PRINT *
  38.         
  39.         RETURN
  40.         END
  41.  
  42. You may have a hard time in doing this on IBM mainframes :-)
  43. --
  44. Furio Ercolessi
  45. Materials Research Laboratory           |   Intl School for Advanced Studies
  46. Univ. of Illinois at Urbana-Champaign   |   Trieste, Italy
  47. furio@uiuc.edu                          |   furio@sissa.it
  48.