[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Print format question for the Experts

I have a question which I think should have a simple answer. Being a master of 
kludging code for physics problems, it's not surprising that I haven't been able 
to figure it out. I'm hoping the experts in this group can.

I am using IDL to read records one at a time from a file and I want to print out 
a message that each record was successfully read, i.e., I would print something 
like the following for record 5:

Record number 5 out of 1500

Because I can have several thousand records in a run, I do not want to have a 
flowing list like:

Record number 1034 out of 1500
Record number 1035 out of 1500
Record number 1036 out of 1500

but instead just want one line where the record number increments, i.e.,

Record number n out of 1500  [where n changes at the same spot]

To do that I tried the following code:

print, format='($,"Record number ",t19,i6,t27,"out of " , t28,i6)',i+1,max_rec
for i=0,max_rec-1 do begin
    print, format='($,tl42,i6)', i+1

What I get is something like:

Record number 1 out of 1500   2   3   4   5   6   7   8   9   10   11   13   14
In other words, the $ format character supresses the new line, but each new 
print sets the next line's "left-right" pointer at the right edge of the 
previous printed line.

I've tried the t format char as well as the tl character with no more luck.

Does anybody know how to do this?


John McFee
Dr. John E. McFee  
Defence Research Establishment Suffield
Box 4000, Medicine Hat, AB Canada T1A 8K6
(403) 544-4739 (voice)    544-4704 (fax)
e-mail: John.McFee@dres.dnd.ca  
Dr. John E. McFee                         | John.McFee@dres.dnd.ca
Head Threat Detection Group               | www.dres.dnd.ca, www.ccmat.gc.ca
Defence Research Establishment Suffield   | PH: 403-544-4739