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

Home » Public Forums » archive » Lots of files
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: Lots of files [message #53131 is a reply to message #53058] Mon, 19 March 2007 09:41 Go to previous messageGo to previous message
lasse is currently offline  lasse
Messages: 48
Registered: February 2007
Member
On 19 Mar, 14:31, David Fanning <n...@dfanning.com> wrote:
> David Fanning writes:
>> Use POINT_LUN, -fin, position & Print, position.
>
> Whoops! Should be:
>
> POINT_LUN, fin, -position & Print, position

no, first solution was correct, using negative file units reads
pointer location rather than setting it.

aaaanyway...

As David suspected (to be honest, I had that feeling, too), the readf
command reads from a file unit until it reaches a newline, then
formats the string according to the format code given (IDL help says:
On input, read data from the file and format it according to the
format code.). Therefore my code was slow, because it read 4MB of data
and then chucked away ... well, lots of it.

If one uses readu instead, one cannot use format code ("The READU
procedure reads unformatted binary data") but it just reads as many
bytes as fit in the variable provided. Hence

line = bytarr(1440)
openr, fin, filename, /get_lun
while not(eof(fin)) do begin
readu, fin, line
hstat = String(line[12:14])
tmp = where(stats eq hstat)
printf, tmp[0]+1, string(line)
endwhile

works like a charm, too. and please note, finally I am able to use the
not(eof(fin)) condition.

Oh, and by the way, the above program runs in 0.05 seconds, whereas
the readf with format takes 75 seconds but that doesn't surprise
anybody, I guess.

Right, that sorted, let's get some work done...
Cheers
Lasse
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: replicating arrays
Next Topic: Re: Question about selecting images from Draw Widgets

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

Current Time: Sat Oct 11 12:38:58 PDT 2025

Total time taken to generate the page: 0.39994 seconds