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.
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.
PRINT [, Expr1, ..., Exprn]
PRINTF [, Unit, Expr1, ..., Exprn]
Keywords: [, AM_PM=[string, string]] [, DAYS_OF_WEEK=string_array{7 names}] [, FORMAT=value] [, MONTHS=string_array{12 names}] [, /STDIO_NON_FINITE]
For PRINTF, Unit specifies the file unit to which the output is sent.
The expressions to be output.
Supplies a string array of 2 names to be used for the names of the AM and PM string when processing explicitly formatted dates (CAPA, CApA, and CapA format codes) with the FORMAT keyword.
Supplies a string array of 7 names to be used for the names of the days of the week when processing explicitly formatted dates (CDWA, CDwA, and CdwA format codes) with the FORMAT keyword.
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.
Supplies a string array of 12 names to be used for the names of the months when processing explicitly formatted dates (CMOA, CMoA, and CmoA format codes) with the FORMAT keyword.
Set this keyword to allow the writing of data files readable by C or FORTRAN programs on a given platform; it is otherwise unnecessary.The various systems supported by IDL differ widely in the representation used for non-finite floating point values (i.e., NaN and Infinity). Consider that the following are all possible representations for NaN on at least one IDL platform:
NaN, NanQ, ?.0000, nan0x2, nan0x7, 1.#QNAN, -1.#IND0.
And the following are considered to be Infinity:
Inf, Infinity, ++.0000, ----.0000, 1.#INF
On input, IDL can recognize any of these, but on output, it uses the same standard representation on all platforms. This promotes cross-platform consistency. To cause IDL to use the system C library sprintf() function to format such values, yielding the native representation for that platform, set the STDIO_NON_FINITE keyword.
The following keywords are obsolete:
For information on obsolete keywords, See Obsolete Features.
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.'
Introduced: Original
ANNOTATE, MESSAGE, WRITEU, XYOUTS