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

Home » Public Forums » archive » Re: archived data
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: archived data [message #54334 is a reply to message #54333] Tue, 05 June 2007 10:12 Go to previous messageGo to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Jun 3, 10:54 am, Wox <nom...@hotmail.com> wrote:
> Hi All,
>
> I face the following situation: I'd like to do some online data
> processing (i.e. during measurements) using IDL. However the data is
> directly zipped by the acquisition system. Is it possible to read and
> search (like file_search) in a zip archive without spawning unzip and
> extract everything? Windows explorer does it, so it must be
> possible...
>
> I remember a similar question beeing posted here, but I couldn't find
> it.
>
> Thanks

I just threw this together. Your milage may vary:

function byte_to_hex, bytes

nbytes = n_elements(bytes)

hstr = string(bytes, format="(z2.2)")

vform = '(' + strtrim(nbytes,2) + 'A)'
hval = string( reverse(hstr),format=vform )
val = 0l
reads, hval, val, format="(z)"

return, val
end

function zipcontents, fname

endsig = '504b0506'

finfo = file_info(fname)
fsize = finfo.size
fdata = bytarr(fsize)

openr, lun, fname, /get_lun
readu, lun, fdata
free_lun, lun

fcode = '(' + strtrim(fsize,2) + 'z2.2)'

sdata = string(fdata, format=fcode)

fptr = strpos(sdata, endsig) / 2

fptr += 8
numentries = byte_to_hex( fdata[fptr:fptr+1] )
fptr += 8

cd_offset = byte_to_hex( fdata[fptr:fptr+3] )
fptr = cd_offset

contents = strarr(numentries)

for i=0l, numentries-1 do begin
fptr += 28

fnamelen = byte_to_hex( fdata[fptr:fptr+1] )
fptr += 2

extrafieldlen = byte_to_hex( fdata[fptr:fptr+1] )
fptr += 2

fcommentlen = byte_to_hex( fdata[fptr:fptr+1] )
fptr += 14

contents[i] = string(fdata[fptr:fptr+fnamelen-1])

fptr = fptr + fnamelen + extrafieldlen + fcommentlen

endfor

return, contents
end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: idl flythru
Next Topic: IDL - COM export bridge

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

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

Total time taken to generate the page: 0.80307 seconds