I want to convert 64 bit binary string to 64 bit integer (unsigned). Is there any library function to do that in C++ ?
Edit:
I use:
main()
{
std::string st = "010111000010010011000100010001110110011010110001010111010010010110100101011001010110010101101010" ;
uint64_t number;
number = strtoull (st.c_str (),NULL,2);
cout << number << " " ;
char ch = std::cin.get();
cout << ch ;
return 0;
}
You can use strtoull()
function with base 2 (there is an example if you follow the link).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With