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

Home » Public Forums » archive » Diagnostic printout
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
Diagnostic printout [message #2502] Thu, 04 August 1994 10:19 Go to next message
mjfreem is currently offline  mjfreem
Messages: 2
Registered: August 1994
Junior Member
I want to be able to print a diagnostic message that tells me
what loop index my routine is on, without having the screen
scroll by. Something equivalent to this:

#include <stdio.h>
main(){
int i,j,a;
for (i=0;i<10;i++){
printf("Processing index number %i \r",i);
a=fflush(NULL);
for (j=0;j<10000000;j++);
}
printf("\n");
}

The j loop is there to waste time, so you can see the numbers iterate.
The a=fflush(NULL) is to make sure the output buffer gets written to the
screen.

I tried
print,format='(t1,"Processing index number ",i2,$),i
but it doesn't work right. Basically, there is no eqivalent to \r
that I can find in IDL.

Thanks, matt
Re: Diagnostic printout [message #2641 is a reply to message #2502] Fri, 05 August 1994 08:06 Go to previous message
mjfreem is currently offline  mjfreem
Messages: 2
Registered: August 1994
Junior Member
sjt@xun8.sr.bham.ac.uk (James Tappin) writes:

> M. Freeman (mjfreem@hubcap.clemson.edu) wrote:
> : I want to be able to print a diagnostic message that tells me
> : what loop index my routine is on, without having the screen
> : scroll by. Something equivalent to this:


> The following works on a Unix system:

> cr=string(13b) ; 13 is ^M = <cr>
> for i = 0, 3 do print, format = '("Processing index number ",i2,a,$)', i, cr

> On VMS I'm not sure as I suspect <cr> may be converted to <crlf>.

Thanks to you and to others who sent me workable solutions!

-matt
Re: Diagnostic printout [message #2647 is a reply to message #2502] Fri, 05 August 1994 04:17 Go to previous message
sjt is currently offline  sjt
Messages: 72
Registered: November 1993
Member
M. Freeman (mjfreem@hubcap.clemson.edu) wrote:
: I want to be able to print a diagnostic message that tells me
: what loop index my routine is on, without having the screen
: scroll by. Something equivalent to this:

: #include <stdio.h>
: main(){
: int i,j,a;
: for (i=0;i<10;i++){
: printf("Processing index number %i \r",i);
: a=fflush(NULL);
: for (j=0;j<10000000;j++);
: }
: printf("\n");
: }

: The j loop is there to waste time, so you can see the numbers iterate.
: The a=fflush(NULL) is to make sure the output buffer gets written to the
: screen.

: I tried
: print,format='(t1,"Processing index number ",i2,$),i
: but it doesn't work right. Basically, there is no eqivalent to \r
: that I can find in IDL.

: Thanks, matt

The following works on a Unix system:

cr=string(13b) ; 13 is ^M = <cr>
for i = 0, 3 do print, format = '("Processing index number ",i2,a,$)', i, cr

On VMS I'm not sure as I suspect <cr> may be converted to <crlf>.

--
James Tappin, School of Physics & Space Research
University of Birmingham
sjt@xun8.sr.bham.ac.uk
"If all else fails--read the instructions!"

O__
-- \/`
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: HELP files (generation of?)
Next Topic: How to read a file in zip or gz format using IDL?

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

Current Time: Wed Oct 08 19:20:35 PDT 2025

Total time taken to generate the page: 0.00553 seconds