MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Binaries

  • To: mathgroup at
  • Subject: [mg69763] Re: Binaries
  • From: dh <dh at>
  • Date: Fri, 22 Sep 2006 01:04:43 -0400 (EDT)
  • References: <eetuj3$9ls$>

Hi David,
your question is not too clear. To you want to read from a file or do 
you want to convert from an n bits integer? What do you exactly mean by 
long: 32, 64, 128 bits?
Further, I assume you are talking about integers. Now do the three bytes 
repesent 1 or 3 numbers?

1) Assuming the three bytes code for one number and the long has 32 bits 
and you want to read from a file. In this case, you can simply read the 
whole 32 integer by:
see manual
2) If the three bytes are 3 different numbers, and you want to read from 
a file written with 32 bits integres, you need to read every single byte 
and throw away the superfluos byte:

3) In case you want to convert Integers, you may use Bit Operators like 
BitAnd,BitOr,.. ,see manual or: Developer`BitShiftLeft/Right


David.MartinyMarero at wrote:
> Dear sirs,
> How can I read binary numbers with the format: three bytes placed in a
> long?
> Thanks,
> D-

  • Prev by Date: Re: TEXT SIZE 12 ?
  • Next by Date: Off[General::spell1] and StyleSheet Notepad
  • Previous by thread: Re: Binaries
  • Next by thread: Programming in Mathematica