comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: error reading file question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: error reading file question [message #51197 is a reply to message #51196] Tue, 07 November 2006 11:34 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paul van Delst writes:

> pro test
> ; Setup error handler
> catch, ierr
> if(ierr ne 0)then begin
> catch, /cancel
> message, !error_state.msg + '; Closing file...', /continue
> if(n_elements(fileid) ne 0) then free_lun, fileid
> return
> endif
> ; Read non-existant file
> openr, fileid, 'newfile.dat', /get_lun
> x=0.0
> readu, fileid, x
> free_lun, fileid
> print, x
> catch,/cancel ; <--- don't forget this
> end

I wouldn't worry about forgetting to cancel
the Catch in the next to last line. CATCH
is only in effect for that program module
anyway, and you are, uh, about to leave
there. :-)

Cheers,

David

P.S. You *should* cancel the CATCH in the first
line of the error handling code, though, because--
Heaven forbid!--if you have an error in your error
handling code you are going to notice!! :-)
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Printing problem as RGB in Linux
Next Topic: 3D plotting

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 07:26:35 PDT 2025

Total time taken to generate the page: 0.63900 seconds