PRINT/PRINTF

The two PRINT procedures perform formatted output. PRINT performs output to the standard output stream (IDL file unit -1), while PRINTF requires a file unit to be explicitly specified.

Calling Sequence

PRINT [, Expr 1 , ..., Expr n ]

or

PRINTF [ , Unit, Expr 1 , ..., Expr n ]

Arguments

Unit

For PRINTF, Unit specifies the file unit to which the output is sent.

Expr i

The expressions to be output.

Keywords

FORMAT

If FORMAT is not specified, IDL uses its default rules for formatting the output. FORMAT allows the format of the output to be specified in precise detail, using a FORTRAN-style specification. See Using Explicitly Formatted Input/Output .

VMS Keywords

REWRITE

When writing data to a file with indexed organization, set the REWRITE keyword to specify that the data should update the contents of the most recently input record instead of creating a new record.

Format Compatibility

If the FORMAT keyword is not present and PRINT is called with more than one argument, and the first argument is a scalar string starting with the characters "$(", this initial argument is taken to be the format specification, just as if it had been specified via the FORMAT keyword. This feature is maintained for compatibility with version 1 of VMS IDL.

Example

To print the string "IDL is fun." enter the command:

PRINT, 'IDL is fun.'

To print the same message to the open file associated with file unit number 2, use the command:

PRINTF, 2, 'IDL is fun.'

See Also

ANNOTATE , MESSAGE , WRITEU , XYOUTS