IDL and Input/Output

IDL provides extensive Input/Output facilities at the user level. Internally, it uses native Input/Output facilities (UNIX system calls or Windows system API) in addition to the standard C library stream package (stdio). The choice of which facilities to use are made based on the target platform and the requested features for the file.

Most external code linked with IDL (CALL_EXTERNAL, system routines, etc.) should not do Input/Output directly for the following reasons:

For the reasons above, only minimal I/O abilities are available from IDL's internals, and only for files that explicitly use the standard C stdio library. Therefore, if your application must directly perform I/O to a file managed by IDL, it is necessary to use the standard C library streampackage (stdio) by specifying the IDL_F_STDIO flag to IDL_FileOpen(). Most of the routines associated with the standard C library I/O package can be used in the normal manner.

Disallowed C Library Routines and Their IDL Counterparts

The C library routines listed in the following table should not be used; use the IDL-specific functions instead:

C-Library Function

IDL Function

fclose()

IDL_FileClose()

fdopen()

IDL_FileOpen()

feof()

IDL_FileEOF()

fflush()

IDL_FileFlushUnit()

fopen()

IDL_FileOpen()

freopen()

IDL_FileOpen()

Note: In order to access a file opened using IDL_FileOpen() in this manner, you must ensure that it is stdio compatible by specifying IDL_F_STDIO as part of the extra_flags argument to IDL_FileOpen(). Failure to do this will cause your code to fail to execute as expected.