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

Home » Public Forums » archive » Re: reading past leading and training bytes
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: reading past leading and training bytes [message #49204 is a reply to message #49201] Thu, 06 July 2006 23:47 Go to previous messageGo to previous message
peter.albert@gmx.de is currently offline  peter.albert@gmx.de
Messages: 108
Registered: July 2005
Senior Member
Hi Jason,

my previous poster's resonse using the f77_unformatted keyword is most
likely the correct solution to your current problem, but a general
solution for skipping any number of bytes would be:

IDL> openw, lun, filename, /get_lun
IDL> skip_it = bytarr(4) ; replace 4 by the actual number of bytes
you'd like to skip
IDL> readu, lun, skip_it

after that, the file pointer is at the correct position to read the
"real" dataset. Well, that was how I read in those fortran-geenrated
files all the time. While writing this, the idea comes to my head that
it might have benn smarter to just use

IDL> openw, lun, filename, /get_lun
IDL> point_lun, lun, 4

instead. Might be worth a try ...

Cheers,

Peter





glaciologist schrieb:

> I'm using readu to read a 101 X 55 (2D) binary file
>
> The file has leading and trailing 4 byte tags ( 00 00 56 CC in
> hexadecimal).
>
> How to skip past these??!
>
> I use this code, which successfully reads in array, but first column
> gets scrambled!~
>
> readu,1,data
> byteorder,data,/xdrtof ; byteswap needed
>
> data are output by Linux Fedora 4 Portland Group FORTRAN executable
> with -byteswapio flag set on compile
>
> With thanks!
>
> Jason Box
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Reading data from file
Next Topic: Re: IVolume/isosurface

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

Current Time: Tue Dec 02 05:55:35 PST 2025

Total time taken to generate the page: 2.48812 seconds