home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!mips!swrinde!elroy.jpl.nasa.gov!ames!news.dfrf.nasa.gov!altair.dfrf.nasa.gov!maine
- From: maine@altair.dfrf.nasa.gov (Richard Maine)
- Newsgroups: comp.lang.fortran
- Subject: Re: peculiar formatted read problem
- Message-ID: <MAINE.92Jul30123048@altair.dfrf.nasa.gov>
- Date: 30 Jul 92 19:30:53 GMT
- References: <1992Jul30.184123.7568@colorado.edu>
- Sender: news@news.dfrf.nasa.gov (Usenet news)
- Organization: NASA Dryden, Edwards, Cal.
- Lines: 39
- In-Reply-To: ejh@khonshu.colorado.edu's message of Thu, 30 Jul 1992 18:41:23 GMT
-
- On Thu, 30 Jul 1992 18:41:23 GMT, ejh@khonshu.colorado.edu (Edward J. Hartnett) said:
-
- Edward> I read in new values for ddata_dir and dfilein. The above
- Edward> works fine. But, if I use default format for the first read
- Edward> (i.e. * instead of '(a80)') I get no error, no end of file,
- Edward> but the old value of ddata_dir is retained, even though there
- Edward> is a new value in the defaults file. Furthermore, dfilein IS
- Edward> read correctly from the file. So how can it skip over the
- Edward> first record, without either having an error (in which case it
- Edward> would go to line 3 and not read in dfilein), or reading in the
- Edward> ddata_dir which is in the defaults file?
-
- Edward> Just on trial and error, and in desperation, I changed the
- Edward> format to '(a80)' and now it works great. But I don't need a
- Edward> format of '(a20)' for fnamein, why?
-
- This is one of my "favorite" careless mistakes to make with
- list-directed input in my own code. (Well, it counts as careless for
- me because I know better - I just forget about it on occasion).
-
- There must be others besides the two of us that run into this, so
- I'm posting my reply instead of e-mailing. I haven't seen this
- particular tidbit posted before.
-
- The character "/" terminates list directed input in exactly the manner
- you describe. Any further values in the input list are left unchanged.
- The next read starts on the following record. This makes list-directed
- input annoying for unix path names. There are two solutions:
-
- 1. Put the data-dir name in quotes. This requires no code changes,
- but results in innumerable questions from the users.
-
- 2. Use "a" format as you did. By the way, you can just use "(a)";
- you don't need to specify the 80 field width.
-
- --
- --
- Richard Maine
- maine@altair.dfrf.nasa.gov
-