简体   繁体   中英

c++ libconfig parsing error?

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;

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM