home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / idlpvwa / 577 < prev    next >
Encoding:
Text File  |  1993-01-01  |  1.8 KB  |  57 lines

  1. Newsgroups: comp.lang.idl-pvwave
  2. Path: sparky!uunet!wupost!crcnis1.unl.edu!moe.ksu.ksu.edu!hobbes.physics.uiowa.edu!ljg
  3. From: ljg@space.physics.uiowa.edu (Larry Granroth)
  4. Subject: Re: tape I/O under Unix: eof always true?
  5. Message-ID: <C07J1y.CwE@space.physics.uiowa.edu>
  6. Organization: The University of Iowa, Department of Physics and Astronomy
  7. X-Newsreader: TIN [version 1.1 PL8]
  8. References: <1992Dec31.141848.354@ll.mit.edu>
  9. Date: Sat, 2 Jan 1993 03:29:56 GMT
  10. Lines: 45
  11.  
  12. Fred Knight (knight@ll.mit.edu) wrote:
  13. : Can anybody give me some help on IDL's handling of eof while reading
  14. : tape under Unix?  The following test fails.  I mount a (test) tar tape
  15. : and do the following:
  16. : IDL> openr,lun,/get_lun,'/dev/rst0'
  17. : IDL> print,eof(lun)
  18. :        1                ; <==== Why? Shouldn't it be zero?
  19. : IDL> point_lun,lun,100
  20. : IDL> print,eof(lun)   
  21. :        1                ; <==== Same question.
  22. : IDL> a=bytarr(2048)
  23. : IDL> readu,lun,a
  24. : IDL> print,eof(lun)
  25. :        1                ; <==== Same question.
  26.  
  27. : Thanks for any help,
  28.  
  29. : Fred
  30. : -- 
  31. : =Fred Knight (knight@ll.mit.edu)    (617) 981-2027
  32. :  C-483\\MIT Lincoln Laboratory\\244 Wood Street\\Lexington, MA  02173
  33.  
  34. Hmmm . . . Didn't my recent posting make it out?  In it, I mentioned
  35. that eof() doesn't work with tape files.  However, using on_ioerror works:
  36.  
  37.   openr,1,'/dev/nrst0'
  38.  
  39.   !error = 0
  40.   on_ioerror, done
  41.  
  42.   while (1) do begin
  43.     readu,1,buf
  44.     ; . . . process data . . .
  45.   endwhile
  46.  
  47.   done:
  48.   if !error then print, !err_string
  49.  
  50. The above will work to read a single file from a tape, however I still
  51. have no answer as to how to read multiple files from a tape.  So far,
  52. the only way I can read a second file is to exit completely out of IDL,
  53. reposition the tape with mt, restart IDL and rerun the application.
  54. I guess I'll be giving RSI a call on Monday.
  55.  
  56. larry-granroth@uiowa.edu
  57.