home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!michael
- From: michael@chpc.utexas.edu (Michael Lemke)
- Subject: Re: CHARACTER IO question
- Message-ID: <1992Dec18.225523.18742@chpc.utexas.edu>
- Organization: The University of Texas System - CHPC
- References: <1992Dec18.222440.19389@sol.ctr.columbia.edu>
- Date: Fri, 18 Dec 92 22:55:23 GMT
- Lines: 51
-
- In article <1992Dec18.222440.19389@sol.ctr.columbia.edu> shenkin@still3.chem.columbia.edu (Peter Shenkin) writes:
- >Suppose I have the following declaration:
- >
- > CHARACTER *100 fname
- >
- >Then, later, the following READ:
- >
- > READ( 5, '(A)' ) fname
- >
- >And suppose the next input record reads as follows, where the 'e' in "file"
- >is the last character in the record:
- >
- >/my/file
- >
- >The question is: does the FORTRAN-77 standard specify what the last 92
- >characters in "fname" should contain, after the READ is done? From
- >section 13.5.11 of the standard:
- >
- [quote of standard deleted]
-
- >On most UNIX machines, the last 92 characters of "fname" get filled with
- >blanks, but I have found that on the Sparc front-end to the CM-5,
- >CMFortran puts a few blanks in, followed by a bunch of ASCII nulls. Is
- >there another part of the standard that addresses this?
-
- I don't know; I leave this to other posters.
-
- >If not, is there
- >any standard way to ensure the blank padding?
-
- I think this will do:
-
- fname = ' '
- read( 5, '(a)' ) fname
-
- >If not, is there any standard
- >way to figure out how wide your input field really was?
-
- I don't think there is a standard way to get at this number but there
- is a very handy VMS extension which also works on Suns:
-
- read( 5, '(q,a)' ) len, fname
-
- len will have the number of characters read into fname. Too bad it
- isn't standard FORTRAN.
-
- Michael
- --
- Michael Lemke
- Astronomy, UT Austin, Texas
- (michael@io.as.utexas.edu or UTSPAN::UTADNX::IO::MICHAEL [SPAN])
-