GET_LUN Procedure
Allocates a file unit from a pool of free units.
Usage
Input Parameters
unit—A named variable.
Output Parameters
unit—On output, unit is converted into an integer containing the file unit number.
Keywords
None.
Discussion
GET_LUN sets unit to the first available logical unit number. This number can then be used to open a file.
User-written PV-WAVE functions and procedures should use GET_LUN to reserve unit numbers to avoid conflicts with other routines. (Similarly, they should use FREE_LUN to free them when finished).
Note: The Get_Lun keyword, used with the OPENR, OPENU, and OPENW procedures, calls GET_LUN to allocate a file unit number. |
Example
Suppose that the first available logical unit number is 100.
; Return the logical unit number to allocate (100). GET_LUN, log_unit ; Open test.dat file for reading. Then read the file. OPENR, log_unit, !Data_Dir + 'mandril.img' my_var = BYTARR(512, 512) READU, log_unit, my_var ; Closes the file and frees the logical unit 100. FREE_LUN, log_unit
See Also
CLOSE, FREE_LUN, ON_IOERROR, OPEN (UNIX), OPEN (Windows), POINT_LUN, READ, WRITEU
For background information, see the PV‑WAVE Programmer’s Guide.