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

Home » Public Forums » archive » Re: overwrite output to screen; unix vs windows
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: overwrite output to screen; unix vs windows [message #80674 is a reply to message #80661] Tue, 26 June 2012 17:23 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
jdeast@gmail.com writes:

> 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?

Ronn Kling's progress bar is a corker. I love it!

http://kilvarock.com/widgets.htm

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: writing equation in IDL
Next Topic: Dropped dimensions?

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

Current Time: Mon Dec 01 14:38:34 PST 2025

Total time taken to generate the page: 1.12184 seconds