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

Home » Public Forums » archive » Reading binary data (written using XDR) into IDL??
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 Binary [message #49250 is a reply to message #4812] Wed, 12 July 2006 07:21 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Dirk1106@googlemail.com wrote:
> for 12 bits
>
> fread(&t0, 3, 1, fp); byteswap(&t0,3);
> fread(&tof, 1, 1, fp);
> fread(&pos1, 2, 1, fp); byteswap(&pos1,2);
> fread(&pos2, 2, 1, fp); byteswap(&pos2,2);
> fread(&ang, 2, 1, fp); byteswap(&ang,2);
> fread(&e1, 1, 1, fp);
> fread(&e2, 1, 1, fp);
>
>
>
> for 13 bits.
>
> fread(&t, 8, 1, fp); byteswap(&t,8);
> fread(&pos, 2, 1, fp); byteswap(&pos,2);
> fread(&ang, 2, 1, fp); byteswap(&ang,2);
> fread(&e, 1, 1, fp);
>

I thought fread worked in units of (8-bit) bytes? My C reference double check confirmed
that also (from http://www.elook.org/programming/c/fread.html)

-------------
fread()

Syntax:

#include <stdio.h>
int fread( void *buffer, size_t size, size_t num, FILE *stream );

Description:
The function fread() reads num number of objects (where each object is size bytes) and
places them into the array pointed to by buffer. The data comes from the given input
stream. The return value of the function is the number of things read...use |feof()| or
|ferror()| to figure out if an error occurs.
-------------

paulv

--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
Ph: (301)763-8000 x7748
Fax:(301)763-8545
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: extraction of linear features from satellite imagery
Next Topic: Displaying isosurface- Hollow images

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

Current Time: Fri Oct 10 07:44:46 PDT 2025

Total time taken to generate the page: 0.48340 seconds