|
External Development Guide: IDL Internals: Files and Input/Output |
|
Files are opened using the IDL_FileOpen() function.
int IDL_FileOpen(int argc, IDL_VPTR *argv, char *argk, int access_mode, IDL_SFILE_FLAGS_T extra_flags, int longjmp_safe, int msg_attr)
IDL_FileOpen() returns TRUE if the file has been successfully opened and FALSE otherwise.
| Note If longjmp_safe is TRUE, the usual course is to jump back to the IDL interpreter, in which case the routine won't return. |
The number of arguments in argv. This value should always be 2.
The arguments to IDL_File_Open(). argv[0] should be a scalar integer value giving the file unit number (LUN) to be opened. argv[1] is a scalar string giving the file name.
Keywords. Set this argument to NULL.
A bit mask that specifies the access to be allowed to the file being opened. The allowed bit values are listed in the following table:
It is important that conflicting bits not be set together (for example, do not specify IDL_OPEN_TRUNC | IDL_OPEN_APND). Also, one or both of IDL_OPEN_R and IDL_OPEN_W must always be specified.
Used to specify additional file attributes using the flags defined in the description of the flags field of the IDL_FILE_STAT struct (see File Information). Note that some flags are set by IDL based on the actual attributes of the opened file (e.g. IDL_F_ISTTY) and that it makes no sense to set such flags in this mask.
If you intend to use the opened file as a C standard I/O (stdio) stream file, you must specify the IDL_F_STDIO flag when calling IDL_FileOpen(). Otherwise, IDL may choose not to use stdio.
If set to TRUE, IDL_FileOpen() is being called in a context where an IDL_MSG_LONGJMP IDL_Message action code is okay. If set to FALSE, the routine won't longjmp().
IDL_FileOpen() returns TRUE if the file has been successfully opened and FALSE otherwise. Of course, if longjmp_safe is TRUE, the usual course is to jump back to the IDL interpreter, in which case the routine won't return.
A zero (0), or any combination of the IDL_MSG_ATTR_ flags, used to fine tune the error handling specified by the longjmp_safe argument. Note that you must not specify any of the base IDL_MSG_ codes, but only the attributes. The base code (e.g. IDL_MSG_LONGJMP) is determined by the value of longjmp_safe. For a discussion of the IDL_MSG_ATTR_ flags, see Issuing Error Messages.
There are three files that are always open. The three units are:
| Note The constant IDL_NON_UNIT always has a value that is not a valid file unit. |
IDL Online Help (March 06, 2007)