System routines that deal with files must verify that the files have the proper attributes for the intended operation. Use the function IDL_FileEnsureStatus() for this.
IDL_FileEnsureStatus()
int IDL_FileEnsureStatus(int action, int unit, int flags)
action
If the file unit does not satisfy the requirements of the flags argument, IDL_FileEnsureStatus() will issue an error using the IDL_Message() function (see Issuing Error Messages. This action is the argument to IDL_Message() and should be IDL_MSG_RET, IDL_MSG_LONGJMP, or IDL_MSG_IO_LONGJMP.
unit
The Logical Unit Number of the file to be checked.
flags
IDL_FileEnsureStatus() always checks to make sure unit is a valid logical file unit. In addition, flags is a bit mask specifying the file attributes that should be checked. The possible bit values are listed in the following table:
- IDL_EFS_USER: The file must be a user unit. This means that the file is not one of the three special files, stdin, stdout, or stderr.
- IDL_EFS_IDL_OPEN: The file unit must be open.
- IDL_EFS_CLOSED: The file unit must be closed.
- IDL_EFS_READ: The file unit must be open for input.
- IDL_EFS_WRITE: The file unit must be open for output.
- IDL_EFS_NOTTY: The file unit cannot be a tty.
- IDL_EFS_NOGUI: The file unit cannot be a Graphical User Interface.
- IDL_EFS_NOPIPE: The file unit cannot be a pipe.
- IDL_EFS_NOXDR: The file unit cannot be a XDR file.
- IDL_EFS_ASSOC: The file unit can be ASSOC’ed. This implies IDL_EFS_USER, IDL_EFS_OPEN, IDL_EFS_NOTTY, IDL_EFS_NOPIPE, IDL_EFS_NOXDR, IDL_EFS_NOCOMPRESS, and IDL_EFS_NOSOCKET.
- IDL_EFS_NOT_RAWIO: The file was not opened with the IDL_F_UNIX_RAWIO attribute. This bit was formerly called IDL_F_NOTSTDIO. IDL_EFS_NOT_RAWIO is the preferred form, but both names are accepted.
- IDL_EFS_NOCOMPRESS: The file unit cannot have been opened for compressed input/output (IDL_F_COMPRESS).
- IDL_EFS_STDIO: The file must be using the C stdio package (IDL_F_STDIO).
- IDL_EFS_NOSOCKET: The file unit cannot be a socket (IDL_F_SOCKET).
Note: Some of these values are contradictory. The caller must select a consistent set.
If the file unit meets the desired conditions, IDL_FileEnsureStatus() returns TRUE. If it does not meet the conditions, and action was IDL_MSG_RET, then it returns FALSE.