Unfortunately in embedded systems sometimes it is not feasible to use strtol function to convert an integer to c string. Using the following C function you will be able to convert any string to an integer number. Although it is not an optimal solution but it will help you solve this kind of problem. Beware that this function is using dynamic memory allocation.

Updated Version Here

(Please do not hesitate to provide any better alternative method)

Also have a look at the following useful C functions: atoi, atof, atol.


You can find the complete source code here : https://gitlab.com/io.d-libraries/extend-c


Write A Comment