Question

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;

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top