Go Down

Topic: Can't convert decimal to HEX? (Read 825 times) previous topic - next topic


Hello, I'm using this function:
String br = String(4294967295, HEX);
But I get this error:
"exit status 1 call of overloaded 'String(long long int, int)' is ambiguous"
Please help,



Feb 16, 2017, 01:27 pm Last Edit: Feb 16, 2017, 01:53 pm by J-M-L
4,294,967,295 is 232 - 1, this is the largest unsigned long you can represent in a 32 bit format

you need to help a bit the pre processor understand what you want to do by explicitly saying you want an unsigned long integer, if you do
Code: [Select]
String br = String(4294967295ul, HEX); // note the ul at the end of the numberyou'll likely get rid of the pb

that being said, just do
Code: [Select]
const char * br = "FFFFFFFF";and don't use the String class...
Hello - Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums.
Bonjour Pas de messages privés SVP, postez dans le forum directement pour que ça profite à tous


Okay, thank you very much! I will try that out!



What are you aiming to do with the value after it is converted to Hex ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up