Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.



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.

Note: IDL uses the standard I/O function sprintf to do its formatting. Different platforms implement this function in different ways, which may lead to slight inconsistencies in the appearance of the output. In most cases, specifying an explicit output format via the FORMAT keyword allows better control over the appearance than simply using the default formatting.

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.


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.'


PRINT [, Expression1, ..., Expressionn]

PRINTF [, Unit, Expression1, ..., Expressionn]

Keywords: [, AM_PM=[string, string]] [, DAYS_OF_WEEK=string_array{7 names}] [, FORMAT=value] [, /IMPLIED_PRINT] [, 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.

Note: Normally, providing an object reference as an argument to PRINT or PRINTF prints information about the object heap variable referred to by the object reference. If the argument is an instance of an object class that overloads the IDL_Object::_overloadPrint method, the value returned by that method will be printed. See IDL_Object for details.



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.


Set this keyword to format the output using the same formatting rules as Implied Print.


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.

Version History




Deprecated REWRITE keyword

See Also

MESSAGE, STRING, WRITEU, General File Access

© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us