Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: retrieving values in binary files

From: rotenca:telvia:it at: 1-Oct-2002 19:21

Hi Hugues,
> I can easily retrieve integer values stored in big-endian or little-endian
format, but an don't know how to retrieve floating values stored as floats or doubles in binary format (big-endian or little-endian). I do not know if this can help, but given a 4/8 byte binary read from a file which represent a float/double IEEEE number, you could do: float: make struct! [num [float]] none change third float #{0000C841} float/num ; == 25 double: make struct! [num [double]] none change third double #{0000000000003940} print double/num ;==25 For big/little endian you should reverse binary before using it. --- Ciao Romano