comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » overwrite output to screen; unix vs windows
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
overwrite output to screen; unix vs windows [message #80675] Tue, 26 June 2012 16:00
jdeast is currently offline  jdeast
Messages: 5
Registered: June 2012
Junior Member
I'd like to print a status that runs inside a for loop and gets overwritten after each iteration, so as not to flood the screen. In unix, you can do it like this:

(unix, good)
IDL> for i=1, 5 do print, i, format='("' + string(13b) + '",i3,"% complete",$)' & print, ''
5% complete

which prints " 1% complete", the "string(13b)" is a carriage return, but the "$" tells it to continue on the same line, so it is promptly overwritten by " 2% complete" and so on until it finishes at " 5% complete", all on the same line. The final print, '' is outside the loop and just resets the IDL prompt when it's done. In this simple example, it happens so fast you only see the final output.

However, the same line, executed in windows, prints it on 5 separate lines:

(windows, bad):
IDL> for i=1, 100 do print, i, format='("' + string(13b) + '",i3,"% complete",$)' & print, ''

1% complete
2% complete
3% complete
4% complete
5% complete

Is there a way to get the unix behavior in windows?

Thanks,
Jason
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Again an FFT question
Next Topic: error

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:48:18 PDT 2025

Total time taken to generate the page: 0.00499 seconds