Previous Application Programming: Files and Input/Output Next

Opening Files

Before a file can be processed by IDL, it must be opened using one of the procedures described in the following table. All open files are associated with a LUN (Logical Unit Number) within IDL, and all input/output routines refer to files via this number. For example, to open the file named data.dat for reading on file unit 1, use the following statement:

OPENR, 1, 'data.dat'  

The OPENR/OPENU/OPENW procedures can be used with certain keywords to modify their normal behavior. Some keywords are generally applicable, while others only have effect under a given operating system. Some operating system specific keywords are allowed (and ignored) under other operating systems in order to facilitate writing portable routines.

 

Table 18-1: IDL File Opening Commands

Table 18-1: IDL File Opening Commands
Procedure
Description
OPENR
Opens an existing file for input only.
OPENW
Opens a new file for input and output. If the named file already exists, its old contents are overwritten.
OPENU
Opens an existing file for input and output.

Platform-Specific Keywords to the OPEN Procedure

Different computers and operating systems perform input/output in different ways. See OPENR/OPENU/OPENW for keywords to the OPEN procedures that apply under UNIX or Microsoft Windows.

  IDL Online Help (March 06, 2007)