home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / fortran / 4805 < prev    next >
Encoding:
Text File  |  1992-12-21  |  1.9 KB  |  62 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!michael
  3. From: michael@chpc.utexas.edu (Michael Lemke)
  4. Subject: Re: CHARACTER IO question
  5. Message-ID: <1992Dec18.225523.18742@chpc.utexas.edu>
  6. Organization: The University of Texas System - CHPC
  7. References: <1992Dec18.222440.19389@sol.ctr.columbia.edu>
  8. Date: Fri, 18 Dec 92 22:55:23 GMT
  9. Lines: 51
  10.  
  11. In article <1992Dec18.222440.19389@sol.ctr.columbia.edu> shenkin@still3.chem.columbia.edu (Peter Shenkin) writes:
  12. >Suppose I have the following declaration:
  13. >
  14. >      CHARACTER *100 fname
  15. >
  16. >Then, later, the following READ:
  17. >
  18. >      READ( 5, '(A)' ) fname
  19. >
  20. >And suppose the next input record reads as follows, where the 'e' in "file"
  21. >is the last character in the record:
  22. >
  23. >/my/file
  24. >       
  25. >The question is:  does the FORTRAN-77 standard specify what the last 92
  26. >characters in "fname" should contain, after the READ is done?  From 
  27. >section 13.5.11 of the standard: 
  28. >
  29. [quote of standard deleted]
  30.  
  31. >On most UNIX machines, the last 92 characters of "fname" get filled with
  32. >blanks, but I have found that on the Sparc front-end to the CM-5,
  33. >CMFortran puts a few blanks in, followed by a bunch of ASCII nulls.  Is
  34. >there another part of the standard that addresses this?  
  35.  
  36. I don't know; I leave this to other posters.
  37.  
  38. >If not, is there
  39. >any standard way to ensure the blank padding?  
  40.  
  41. I think this will do:
  42.  
  43.     fname = ' '
  44.     read( 5, '(a)' ) fname
  45.  
  46. >If not, is there any standard
  47. >way to figure out how wide your input field really was?
  48.  
  49. I don't think there is a standard way to get at this number but there 
  50. is a very handy VMS extension which also works on Suns:
  51.  
  52.     read( 5, '(q,a)' ) len, fname
  53.  
  54. len will have the number of characters read into fname.  Too bad it 
  55. isn't standard FORTRAN.
  56.  
  57. Michael
  58. -- 
  59. Michael Lemke
  60. Astronomy, UT Austin, Texas
  61. (michael@io.as.utexas.edu or UTSPAN::UTADNX::IO::MICHAEL [SPAN])
  62.