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

Home » Public Forums » archive » Re: Read binary 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: Read binary data [message #61376 is a reply to message #61372] Wed, 16 July 2008 09:13 Go to previous messageGo to previous message
Spon is currently offline  Spon
Messages: 178
Registered: September 2007
Senior Member
On Jul 16, 4:50 pm, xiao zhang <littledd...@gmail.com> wrote:
> HI~ every one ~
> I am trying to read a binary file which is 17920168 bytes and the
> first 168 bytes of it is header infromation, The rest of it is
> 800*800*14 two bytes integer. (like a 3 dimention array.) Can any
> one help me to read it out ? There should not be so many zeros in it,
> but i tried several times it still shows a lot of zero.
> Thanks~

OpenR, Lun, MyFile, /Get_Lun
Point_Lun, Lun, 168
MyData = Intarr(800, 800, 14, /NoZero)
ReadU, Lun, MyData
Free_Lun, Lun

OR:

MyData = Read_Binary(MyFile, Data_Type = 2, Data_Start = 168, $
Data_Dims = [800, 800, 14])

The advantage of the first method is that it's fast. The advantage of
the second method is that if you're running into little/big endian
issues, you can simply set the endian keyword as needed.

Here's a helpful article if you're not sure:
http://www.dfanning.com/tips/endian_machines.html

Regards,

Chris
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: IDL 7 bookmarks
Next Topic: Save File Surprise

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

Current Time: Thu Oct 09 20:26:54 PDT 2025

Total time taken to generate the page: 0.16773 seconds