This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

itoa (Int to String)

Hey, please excuse the lack of expertise, but it has been years since i've programmed and I am just getting back into it.

I have 2 questions.

1) Why are the standard libraries for Arm different than other standard C libraries. For example, the stdlib library is missing the itoa() function that is available for other compilers. Can I use these libraries for the Arm or do i need one that is specifically made for the Arm compiler. Another example is string.h, where in the past i remember being able to create a variable using the typedef "string" where as in now i cannot.

2) Is there an easy alternative to converting an integer to a string?

Any help is really appreciated.
Thanks
Omer

2)

Parents
  • Don't mention "standard libraries" and itoa() in the same sentence. itoa is not standard.

    There are a number of alternative methods to convert a number to ASCII. The most general is normally sprintf() or snprintf().

    string.h and the datatype string are two completely different entities.

    string.h contains the declarations for use with C-type zero-terminated strings.

    C++ has the std::string data type (previously known only as string) but then you should write

    #include <string>
    

    and not

    #include <string.h>
    

Reply
  • Don't mention "standard libraries" and itoa() in the same sentence. itoa is not standard.

    There are a number of alternative methods to convert a number to ASCII. The most general is normally sprintf() or snprintf().

    string.h and the datatype string are two completely different entities.

    string.h contains the declarations for use with C-type zero-terminated strings.

    C++ has the std::string data type (previously known only as string) but then you should write

    #include <string>
    

    and not

    #include <string.h>
    

Children