next up previous
Next: Low Level Routines Up: Overview of Library Routines Previous: High Level Routines


Mid Level Routines

The mid-level routines provide two procedures to read from and write variables to a save file. These routines are most useful to programmers who wish to provide the ability to save and restore IDL variables in a format native to IDL, with a minimum of fuss.

CMSVREAD and CMSVWRITE provide simple routines that read and write data from a save file. These routines are as easy to use as READF and PRINTF.

For example, to write the three variables A B and C to a save file, the following code is all that is necessary.

openw, 50, 'test.sav'       ;; Add /STREAM under VMS !
cmsvwrite, 50, a, name='a'
cmsvwrite, 50, b, name='b'
cmsvwrite, 50, c, name='c'
close, 50

Similar code is used to read variables from a file. However, save files can in principle contain pointers and objects, which CMSVREAD and CMSVWRITE cannot handle. For those cases it is best to use either the high- or low-level routines. The mid-level routines are best when it is known that a save file will have basic variables only, usually in a predetermined order.



Craig Markwardt 2011-12-21