0

I am trying to leverage the libconfig library in my c++ code to read in data. I have a bitmask binary value that I am trying to read in from an external file. The problem is when I read the data in, I believe libconfig is interpreting or parsing the integer as a base 10 number and not as a base 2 number and thus affecting the value. I looked in the libconfig FAQ and it points to hexadecimal representation as "0x" but nothing on binary ("0b" prefix doesn't work).

Anyone know a work around, I have a lot of these bitmasks and its quite troublesome to convert all base 2 numbers to their base 10 counter parts.

Example in the libconfig file:

bitmask = 00000000001000000010010100001101;

timrau
  • 22,578
  • 4
  • 51
  • 64
5k1zk17
  • 369
  • 1
  • 4
  • 11

1 Answers1

0

I'm not familiar with libconfig, but can you persuade it to read these bitmasks as strings? Then do the conversion in your own code.

zwol
  • 135,547
  • 38
  • 252
  • 361