I need to parse std::string containing a binary number, like this:
0b01101101
I know that I can use the std :: hex format specifier to parse numbers in hexadecimal format.
std::string number = "0xff"; number.erase(0, 2); std::stringstream sstream(number); sstream << std::hex; int n; sstream >> n;
Is there something equivalent for binary format?
c ++ format binary c ++ 11 stringstream
Nick
source share