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

Home » Public Forums » archive » Reading in a bunch of bytes
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
Reading in a bunch of bytes [message #6468] Tue, 02 July 1996 00:00
Phil Williams is currently offline  Phil Williams
Messages: 78
Registered: April 1996
Member
I hope someone out there can point out the stupid thing I'm doing that
causes this to fail, cause all my hair is on the floor around my chair
at present.

I have a binary file of 2 256x128x64 arrays of longs that are
interleaved by rows. Here's what I do to try and read it:

openr,1,'file'
s = fstat(1)
data = bytarr(s.size) ; s.size = 8388608 = 256*128*64*4
readu,1,data
close,1

xsize = 256
ysize = 128
zsize = 64

junk1 = fltarr(xsize,ysize,zsize)
junk2 = fltarr(xsize,ysize,zsize)

offset = xsize*4. ; 4 bytes/pixel
k = 0

for i = 0,zsize-1 do begin
for j = 0,ysize-1 do begin
off1 = offset*long(k)
off2 = offset*long(k+1)
junk1 = long(data,off1,xsize)
junk2 = long(data,off2,xsize)
k = k + 2
endfor
endfor

end

Everything looks good to me, but I always end up offsetting past the end
of the data. Any help would be greatly apreciated!

Thanks in advance,

--
/*********************************************************** ********/
Phil Williams, Ph.D.
Research Instructor
Children's Hospital Medical Center "One man gathers what
Imaging Research Center another man spills..."
3333 Burnet Ave. -The Grateful Dead
Cincinnati, OH 45229
email: williams@irc.chmcc.org
URL: http://scuttle.chmcc.org/~williams/
/*********************************************************** ********/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Simple MODULO question.
Next Topic: Re: save/restore file format

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

Current Time: Wed Oct 08 18:07:15 PDT 2025

Total time taken to generate the page: 0.00482 seconds