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 #80651 is a reply to message #80646] Wed, 27 June 2012 09:32 Go to previous messageGo to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
On 27 juin, 01:00, jde...@gmail.com wrote:
> 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
>
>

You can use a combination of T and $ formats:
IDL> print,indgen(10),FORMAT='(10(T1,i4,$))' & print
9

alx.
[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: Sat Oct 11 07:48:56 PDT 2025

Total time taken to generate the page: 1.20324 seconds