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 #61466 is a reply to message #61376] Wed, 16 July 2008 10:15 Go to previous message
mankoff is currently offline  mankoff
Messages: 131
Registered: March 2004
Senior Member
On Jul 16, 12:13 pm, Spon <christoph.b...@gmail.com> wrote:
> 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


The first method also lets you set an endian or swap_endian keyword on
the OPEN statement.

-k.
[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: Sun Oct 26 23:52:27 PDT 2025

Total time taken to generate the page: 0.32792 seconds