Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 3 months ago.
Binary string to int
Hello,
how can I in mbed convert binary string as "011011" to int number?
Thank you for reply
1 Answer
10 years, 3 months ago.
You can use strol(); It takes a start and end pointer for the string and the base to use for the conversion. Assuming the only thing in your string is the number the end pointer can be null and for binary the base is 2
e.g.
char text[]="01011001";
long int value = strtol(text,null,2);