Convert Byte Array into Bitset

Posted by Unknown on Stack Overflow See other posts from Stack Overflow or by Unknown
Published on 2009-04-02T02:51:11Z Indexed on 2010/04/25 12:03 UTC
Read the original article Hit count: 449

Filed under:
|
|

I have a byte array generated by a random number generator. I want to put this into the STL bitset.

Unfortunately, it looks like Bitset only supports the following constructors:

  1. A string of 1's and 0's like "10101011"
  2. An unsigned long. (my byte array will be longer)

The only solution I can think of now is to read the byte array bit by bit and make a string of 1's and 0's. Does anyone have a more efficient solution?

© Stack Overflow or respective owner

Related posts about c++

Related posts about bitset