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

  1. 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
  2. From: maine@altair.dfrf.nasa.gov (Richard Maine)
  3. Newsgroups: comp.lang.fortran
  4. Subject: Re: peculiar formatted read problem
  5. Message-ID: <MAINE.92Jul30123048@altair.dfrf.nasa.gov>
  6. Date: 30 Jul 92 19:30:53 GMT
  7. References: <1992Jul30.184123.7568@colorado.edu>
  8. Sender: news@news.dfrf.nasa.gov (Usenet news)
  9. Organization: NASA Dryden, Edwards, Cal.
  10. Lines: 39
  11. In-Reply-To: ejh@khonshu.colorado.edu's message of Thu, 30 Jul 1992 18:41:23 GMT
  12.  
  13. On Thu, 30 Jul 1992 18:41:23 GMT, ejh@khonshu.colorado.edu (Edward J. Hartnett) said:
  14.  
  15. Edward> I read in new values for ddata_dir and dfilein. The above
  16. Edward> works fine.  But, if I use default format for the first read
  17. Edward> (i.e. * instead of '(a80)') I get no error, no end of file,
  18. Edward> but the old value of ddata_dir is retained, even though there
  19. Edward> is a new value in the defaults file. Furthermore, dfilein IS
  20. Edward> read correctly from the file. So how can it skip over the
  21. Edward> first record, without either having an error (in which case it
  22. Edward> would go to line 3 and not read in dfilein), or reading in the
  23. Edward> ddata_dir which is in the defaults file?
  24.  
  25. Edward> Just on trial and error, and in desperation, I changed the
  26. Edward> format to '(a80)' and now it works great. But I don't need a
  27. Edward> format of '(a20)' for fnamein, why?
  28.  
  29. This is one of my "favorite" careless mistakes to make with
  30. list-directed input in my own code.  (Well, it counts as careless for
  31. me because I know better - I just forget about it on occasion).
  32.  
  33. There must be others besides the two of us that run into this, so
  34. I'm posting my reply instead of e-mailing.  I haven't seen this
  35. particular tidbit posted before.
  36.  
  37. The character "/" terminates list directed input in exactly the manner
  38. you describe.  Any further values in the input list are left unchanged.
  39. The next read starts on the following record.  This makes list-directed
  40. input annoying for unix path names.  There are two solutions:
  41.  
  42. 1. Put the data-dir name in quotes.  This requires no code changes,
  43.    but results in innumerable questions from the users.
  44.  
  45. 2. Use "a" format as you did.  By the way, you can just use "(a)";
  46.    you don't need to specify the 80 field width.
  47.  
  48. --
  49. --
  50. Richard Maine
  51. maine@altair.dfrf.nasa.gov
  52.