Diagnostic printout [message #2502] |
Thu, 04 August 1994 10:19  |
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  |
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  |
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__
-- \/`
|
|
|