Hi I have a problem converting a string binary to a decimal
I was using bitset
bitstring ="1011010001111111";
unsigned long binToDec( string bitstring){
bitset<32> dec (bitstring);
return dec.to_ulong();
}
All of this works fine, but !! the problem comes when i try to do the same with a bits string with more of 32 bits. I know that bitset only does the conversion with 4 bytes, but i need to do the conversion with strings that has 48 or 56 bits (sometimes i need to get 14 or 15 digits )
string bitstring;
bitstring ="11100101001001000000100000100100110100110011010001111111";
i want to get this number: 64497387062899840
Any sugestion? anybody have a function to transform a binary string to decimal ?
Note: i can´t use boost because it´s not ported to the iphone.
Thanks for your help