Re: OpenW units ... [message #40480] |
Tue, 10 August 2004 08:53 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Rafael Loos writes:
> Hi, is there a way to have different units for writting in a loop?
>
> Something like that (Trying to open 6 files):
>
> For num = 0, 5 DO BEGIN
> OpenW, num , FILEPATH , /Get_Lun
> ENDFOR
>
> That does not work ... but is there a way to do that?
Well, you are overwriting your variable "num" six
times. You have the files open, alright, you just
can't reach five of them. :-)
Try this:
fileunits = IntArr(6)
For j = 0, 5 DO BEGIN
OpenW, num , FILEPATH, /Get_Lun
fileunits[j] = num
ENDFOR
Now you can access your files via the fileunits array.
OpenR, fileunits[3], ....
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|