Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16100

How to read 12 bits from a stream ?

From János Löbb <janos@lobb.com>
Newsgroups comp.soft-sys.math.mathematica
Subject How to read 12 bits from a stream ?
Date 2013-10-22 04:53 +0000
Message-ID <l450c4$shl$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


Hi,

I am trying to read a mixed file - binary and text -  with OpenRead and Read and BinaryRead, but I am not seeing a seek option, that is to move the pointer inside the file where I want it to be.  Of course I can do a read in a loop with a counter, but I hoped there is a better way to do it.

The file is 16.1MB, the first 912 elements are characters and binary mixed, followed by 16MB binary section.  The binary in this second section is  packed in the way that 2 times 12 bits  of little endian value is packed into 3 bytes.  I need to unpack them and put them into big endian order.  I am not seeing how can I read 12 bits at once with BinaryRead, it is aligned at the multiples of 8 bits.

Any good tip ?

Thanks ahead,
J=E1nos

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

How to read 12 bits from a stream ? János Löbb <janos@lobb.com> - 2013-10-22 04:53 +0000
  Re: How to read 12 bits from a stream ? Vince Virgilio <blueschi@gmail.com> - 2013-10-24 03:33 +0000
  Re: How to read 12 bits from a stream ? roby <roby.nowak@gmail.com> - 2013-10-24 03:33 +0000

csiph-web