Re: FREE_LUN supposed to work in a loop? [message #84426] |
Sun, 02 June 2013 11:48 |
fgg
Messages: 67 Registered: April 2010
|
Member |
|
|
Thanks!
> Free_Lun both closes and frees up a logical unit number that has been
>
> opened with Get_Lun (i.e., one in the range 100-128). There is no need
>
> to use an additional Close in this case. Close should be used if you
>
> have chosen a logical unit number from the range 1-99 (i.e, OpenR, 5,
>
> ...). Then, using a Close both closes the file and frees it. There is no
>
> need to use Free_Lun in this case.
>
>
>
> Cheers,
>
>
>
> David
>
>
>
>
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
Re: FREE_LUN supposed to work in a loop? [message #84428 is a reply to message #84426] |
Sat, 01 June 2013 22:23  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
fgg writes:
> I think I found the problem. run_this_procedure opens the control_file and then uses a simple CLOSE, never really deallocating the unit. Any danger in substituting CLOSE for FREE_LUN?
Free_Lun both closes and frees up a logical unit number that has been
opened with Get_Lun (i.e., one in the range 100-128). There is no need
to use an additional Close in this case. Close should be used if you
have chosen a logical unit number from the range 1-99 (i.e, OpenR, 5,
...). Then, using a Close both closes the file and frees it. There is no
need to use Free_Lun in this case.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
Re: FREE_LUN supposed to work in a loop? [message #84430 is a reply to message #84428] |
Sat, 01 June 2013 22:04  |
fgg
Messages: 67 Registered: April 2010
|
Member |
|
|
I think I found the problem. run_this_procedure opens the control_file and then uses a simple CLOSE, never really deallocating the unit. Any danger in substituting CLOSE for FREE_LUN? Thanks!
On Sunday, June 2, 2013 12:40:31 AM UTC-4, fgg wrote:
> Hi there,
>
>
>
> I'm getting "OPENR: All available logical units are currently in use" when running something like this:
>
>
>
> for i = 0, n_elements(texts)-1 do begin
>
> openw, lun, control_file, /get_lun
>
> printf, lun, 'some text'
>
> free_lun, lun
>
> run_this_procedure ;this is a *.pro that uses the control_file just created above
>
> endfor
>
>
>
> If I do "help, /files" I see that all units have been closed but are still reserved. Why?! Any suggestion?
>
>
>
> Thanks!
|
|
|