Fanning Software Consulting

Suppress Line Feed

QUESTION: Is there a way to suppress the line feed that is generated in association with the PRINT or PRINTF procedures? In other words, I would like to use two separate calls to PRINT to output text on the same line.

ANSWER: Yes, the “$” character can be used to suppress line feeds. Here is a short example file and its output.

   PRO Example
    a = 10.4 
    b = 6.2
    Print, a, Format='(F10.2, $)'
    Print, b

Running the program produces this output.

   IDL> example
     10.40      6.20000

This will put one value after the other on the same line. If you wish to write from the start of the same line, over and over, then you need to include a Carriage Return character in your Print statement, too, like this.

    IDL> FOR j=1,100 DO Print, String(13b), j, Format='(A,I,$)'

Unfortunately, this trick does not work in the IDL Workbench console, but only from a UNIX console to the best of my knowledge.

Web Coyote's Guide to IDL Programming